python-twitter: twitter.error.TwitterError: [{'code': 34, 'message': 'Sorry, that page does not exist.'}]
Whenever I make a request with the api to fetch Direct Messages api.GetDirectMessages()
, it always throws me a twittererror with the message “Sorry, that page does not exist.”
Traceback:
Traceback (most recent call last):
File "C:/Users/neela/Desktop/Programs/python projects/Mine/DM Storage/login.py", line 13, in <module>
logging.info(api.GetDirectMessages())
File "C:\Program Files\Python36\lib\site-packages\twitter\api.py", line 2937, in GetDirectMessages
data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
File "C:\Program Files\Python36\lib\site-packages\twitter\api.py", line 4908, in _ParseAndCheckTwitter
self._CheckForTwitterError(data)
File "C:\Program Files\Python36\lib\site-packages\twitter\api.py", line 4928, in _CheckForTwitterError
raise TwitterError(data['errors'])
twitter.error.TwitterError: [{'code': 34, 'message': 'Sorry, that page does not exist.'}]
I tried looking through #592 , but it was closed at Nov. 2018, and the new endpoints should have been implemented. There have been four months since the closure, and how has there not been enough time to update the API endpoints?
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 16
Hi guys, the Error is caused by the old version of pip package, in the pip version the function GetDirectMessages uses an old URL, you can change that for the new url. Step 1: find api.py file run pip show python-twitter and see the path
Step 2: find the old url in api.py, line 2922
Step 3: change that line with url = ‘%s/direct_messages/events/list.json’ % self.base_url
This plus
return_json=True
made it work for me+1 have this problem
@DVRodri8 So you mean update the package?
here’s a quick hack to be able to use json: https://github.com/TrustedCapsules/python-twitter/commit/e0c90859e136a833d5bf7264438718f1b0cf85c2
The DirectMessage class needs to be updated (see https://github.com/TrustedCapsules/python-twitter/blob/e0c90859e136a833d5bf7264438718f1b0cf85c2/twitter/models.py#L180)
Honestly if I knew how a token was received and then requested to the API I could send a push request to fix it.
From: Eric Semeniuc notifications@github.com Sent: Tuesday, February 12, 2019 7:18 PM To: bear/python-twitter python-twitter@noreply.github.com Cc: PokestarFan sarkaraoyan@gmail.com; Author author@noreply.github.com Subject: Re: [bear/python-twitter] twitter.error.TwitterError: [{‘code’: 34, ‘message’: ‘Sorry, that page does not exist.’}] (#603)
+1 have this problem
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bear/python-twitter/issues/603#issuecomment-462999286 , or mute the thread https://github.com/notifications/unsubscribe-auth/ANSYJzAcOs2a_qH9R0eRvY1MXPRJVOLEks5vM1m2gaJpZM4af7zf . https://github.com/notifications/beacon/ANSYJxXycUJo_2EYaizlJqMN2dfwUxEDks5vM1m2gaJpZM4af7zf.gif
This email has been checked for viruses by AVG. https://www.avg.com