commit e8b8de7ca0bc8bcc141ac043054779f78a369a8d from: mischa date: Fri Jul 08 21:52:24 2022 UTC catch all 4xx error codes with POST commit - 5f0eb2bc4cbe9100752c8399a03d23fdfdc09e58 commit + e8b8de7ca0bc8bcc141ac043054779f78a369a8d blob - 3c470f957fa7dfe0564a02572681f23f1a511b0e blob + 13e2d20e2708766c602432a2177d1c404cec3e0f --- push.py +++ push.py @@ -136,8 +136,9 @@ def alkira_post(session, uri, body): url = f'{ALKIRA_BASE_URI}{uri}' try: response = session.post(url, data=json.dumps(body), headers=headers) - if response.status_code == 400: - logging.error(response.content) + match int(str(response.status_code)[0]): + case 4: + logging.error(response.content) response.raise_for_status() except Exception as e: logging.error(f'Error: {str(e)}')