Skip to content
Snippets Groups Projects
Unverified Commit 9a530aa7 authored by Max Adamo's avatar Max Adamo
Browse files

checking http status code

parent 4b4ab6bf
Branches
Tags
No related merge requests found
......@@ -31,6 +31,15 @@ session = requests.Session()
session.auth = (sq_token, '')
req = session.get('https://sonarqube.software.geant.org/api/projects/search')
if req.status_code == 401:
print('Error: Invalid token')
os.sys.exit(1)
if req.status_code != 200:
print(f'Error: {req.status_code}')
os.sys.exit(1)
proj_list = req.json()['components']
final_list = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment