Add timeout to HTTP requests in Python samples (#219)

* Add timeout to request to avoid endless hangs

* Add timeout to request to avoid endless hangs
This commit is contained in:
Robin-Manuel Thiel 2020-05-27 18:23:12 +02:00 committed by GitHub
parent ea1739e07d
commit da05bb0180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ while True:
message = {"data": {"orderId": n}}
try:
response = requests.post(dapr_url, json=message)
response = requests.post(dapr_url, json=message, timeout=5)
except Exception as e:
print(e)

View File

@ -16,7 +16,7 @@ while True:
message = {"data": {"orderId": n}}
try:
response = requests.post(dapr_url, json=message)
response = requests.post(dapr_url, json=message, timeout=5)
except Exception as e:
print(e)