Skip to content

Commit cbbf71d

Browse files
author
admin
committed
added retry to get system info page
1 parent eeb0d17 commit cbbf71d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/util/api/jira_clients.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import json
22
import string
3+
import time
4+
35
from selenium.common.exceptions import WebDriverException
46

57
from util.api.abstract_clients import RestClient
@@ -207,7 +209,7 @@ def get_system_info_page(self):
207209
'webSudoDestination': '/secure/admin/ViewSystemInfo.jspa',
208210
'webSudoIsPost': False,
209211
'webSudoPassword': self.password
210-
}
212+
}
211213
tsv_login_body = {"username": self.user,
212214
"password": self.password,
213215
"rememberMe": "True",
@@ -224,8 +226,14 @@ def get_system_info_page(self):
224226
else:
225227
self.post(login_url, error_msg='Could not login in')
226228
auth_body['atl_token'] = self.session.cookies.get_dict()['atlassian.xsrf.token']
227-
system_info_html = self.session.post(auth_url, data=auth_body, headers={'X-Atlassian-Token': 'no-check'}, verify=self.verify)
228-
return system_info_html.content.decode("utf-8")
229+
number_of_attempts = 5
230+
for _ in range(0, number_of_attempts):
231+
system_info_html = self.session.post(auth_url, data=auth_body, headers={'X-Atlassian-Token': 'no-check'}, verify=self.verify)
232+
if system_info_html.status_code == 200:
233+
return system_info_html.content.decode("utf-8")
234+
time.sleep(1)
235+
print(f"ERROR: Could not get the system information page.")
236+
return ""
229237

230238
def get_available_processors(self):
231239
try:

0 commit comments

Comments
 (0)