[BUG] How to handle exception on user has turned off comments for this post #507
Unanswered
Chuckler22
asked this question in
Q&A
Replies: 3 comments 3 replies
-
Oh, here is my handle_exception:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
https://adw0rd.github.io/instagrapi/usage-guide/handle_exception.html |
Beta Was this translation helpful? Give feedback.
0 replies
-
Cool, thanks. So is this basically the correct way to use the handle_exception function?
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Compensate with donations ($10 and more) for the time I spent to fix problems or send me your Pull Request with fixes
Describe the bug
When attempting to comment on a post where the author has turned off comments, the system throws an exception and can't recover (or at least I don't know how to).
To Reproduce
Attempt to post a comment to a post where the author has turned off comments for the post.
Traceback
See Below.
Expected behavior
I'm using try, except, finally to attempt to carry on regardless of this error, but that doesn't work.
Screenshots
Not applicable.
Desktop (please complete the following information):
Additional context
Uncaught exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
response.raise_for_status()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 953, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/media/2xxxxxxxxxxxxx774/comment/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insta.py", line 168, in update_comments
cl.media_comment(str(x[1]),str(x[2]))
File "/usr/local/lib/python3.7/site-packages/instagrapi/mixins/comment.py", line 98, in media_comment
self.with_action_data(data),
File "/usr/local/lib/python3.7/site-packages/instagrapi/mixins/private.py", line 445, in private_request
raise e
File "/usr/local/lib/python3.7/site-packages/instagrapi/mixins/private.py", line 432, in private_request
self._send_private_request(endpoint, **kwargs)
File "/usr/local/lib/python3.7/site-packages/instagrapi/mixins/private.py", line 336, in _send_private_request
% (message, last_json.get("feedback_message")),
instagrapi.exceptions.FeedbackRequired: feedback_required: xxxxxxxxxx has turned off comments for this post.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insta.py", line 204, in
update_comments()
File "insta.py", line 172, in update_comments
raise RuntimeError("Test unhandled")
RuntimeError: Test unhandled
Beta Was this translation helpful? Give feedback.
All reactions