Changed error handling, added comments

This commit is contained in:
Michał Kalinowski
2024-09-22 12:59:54 +02:00
parent 8ab30b8948
commit ea15adf099
4 changed files with 13 additions and 1 deletions

3
.gitignore vendored Executable file
View File

@@ -0,0 +1,3 @@
.venv/
.env
*.crt

0
README.md Normal file → Executable file
View File

11
main.py Normal file → Executable file
View File

@@ -19,11 +19,16 @@ JIRA_URL = 'https://globaljira.roche.com/rest/api/2/issue/picker'
USERNAME = os.getenv("JIRA_USER") USERNAME = os.getenv("JIRA_USER")
PASSWORD = os.getenv("JIRA_PASSWORD") PASSWORD = os.getenv("JIRA_PASSWORD")
ROOT_CERT = ".\\Roche G3 Root CA.crt" ROOT_CERT = ".\\Roche G3 Root CA.crt"
PRINT_RESPONSE_ON_ERR = False
headers = { headers = {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
# For this query for user kalinom6 there are 6 results, 5 of them are correct,
# but one is certainly not associated with the user in any way according to
# the web application. The result set is lacking too, there should be way
# more issues assigned to this user
query = { query = {
'query': f'assignee = {USERNAME} AND status not in (Closed, Done)' 'query': f'assignee = {USERNAME} AND status not in (Closed, Done)'
} }
@@ -47,4 +52,8 @@ if response.status_code == 200:
print(issues) print(issues)
else: else:
print(f"Failed to execute JQL query. Status code: {response.status_code}") print(f"Failed to execute JQL query. Status code: {response.status_code}")
print("Response:", response.text) if response.status_code == 403:
print("If you're sure you've set up the environment variables correctly\n \
Please login to Jira in the browser to solve a CAPTCHA.")
if PRINT_RESPONSE_ON_ERR:
print("Response:", response.text)

0
requirements.txt Normal file → Executable file
View File