HTTPError exception handling #1423
leonardodafishy
started this conversation in
General
Replies: 1 comment
-
Print and compare the types of exceptions, maybe it are different or the exit is in the wrong place, debug your application |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do i do an exception handling for this?
Traceback (most recent call last):
File "C:\Users\koton\PycharmProjects\Recognizance-py\venv\lib\site-packages\instagrapi\mixins\private.py", line 360, in _send_private_request
response.raise_for_status()
File "C:\Users\koton\PycharmProjects\Recognizance-py\venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://i.instagram.com/api/v1/locations/*************/sections/
i tried doing
except HTTPError as e:
self.close()
QtWidgets.QMessageBox.critical(self, "ERROR! :P", f'{e}\n\nPlease try again later.')
sys.exit(0)
but it doesn't seem to be catching the error, even when i specify the status code
Beta Was this translation helpful? Give feedback.
All reactions