Changed error handling, added comments
This commit is contained in:
3
.gitignore
vendored
Executable file
3
.gitignore
vendored
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
.venv/
|
||||||
|
.env
|
||||||
|
*.crt
|
||||||
11
main.py
Normal file → Executable file
11
main.py
Normal file → Executable 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
0
requirements.txt
Normal file → Executable file
Reference in New Issue
Block a user