Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try 9 times before Timeout Error 529 #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions check_azure_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,24 @@ def _call_arm_rest_api(client, path, api_version, method='GET', body=None, query
request = getattr(client, method.lower())(
url=path, params=dict(query or {}, **{'api-version': api_version})
)
response = client.send(
request=request, content=body,
headers=dict(headers or {}, **{'Content-Type': 'application/json; charset=utf-8'}),
timeout=timeout
)

count=0
timeout=10
while True:
try:
count+=1
response = client.send(
request=request, content=body,
headers=dict(headers or {}, **{'Content-Type': 'application/json; charset=utf-8'}),
timeout=timeout
)
except:
timeout+=1
if count >= 9:
print(f'Timeout! {timeout:.2f}')
break
else:
break

try:
response.raise_for_status()
Expand Down