You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
twitter.error.TwitterError: [{'code': 34, 'message': 'Sorry, that page does not exist.'}] #603
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?
Hi, I tried the fix and it didn't work, I just get the following:
Traceback (most recent call last):
File "[path_removed]/tweeting.py", line 13, in
api.GetDirectMessages()
File "[path_removed]/twitter/api.py", line 2942, in GetDirectMessages
return [DirectMessage.NewFromJsonDict(x) for x in data]
File "[path_removed]/twitter/api.py", line 2942, in
return [DirectMessage.NewFromJsonDict(x) for x in data]
File "[path_removed]/twitter/models.py", line 88, in NewFromJsonDict
json_data = data.copy()
AttributeError: 'str' object has no attribute 'copy'
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
Reacted by badler, Fahd Allebdi, Jeff Reifman, Phil and vicky 🌼
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
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
Activity
esemeniuc commentedon Feb 13, 2019
+1 have this problem
PythonCoderAS commentedon Feb 13, 2019
esemeniuc commentedon Feb 13, 2019
here's a quick hack to be able to use json: TrustedCapsules@e0c9085
The DirectMessage class needs to be updated (see https://github.com/TrustedCapsules/python-twitter/blob/e0c90859e136a833d5bf7264438718f1b0cf85c2/twitter/models.py#L180)
theelk801 commentedon Mar 19, 2019
Hi, I tried the fix and it didn't work, I just get the following:
Traceback (most recent call last):
File "[path_removed]/tweeting.py", line 13, in
api.GetDirectMessages()
File "[path_removed]/twitter/api.py", line 2942, in GetDirectMessages
return [DirectMessage.NewFromJsonDict(x) for x in data]
File "[path_removed]/twitter/api.py", line 2942, in
return [DirectMessage.NewFromJsonDict(x) for x in data]
File "[path_removed]/twitter/models.py", line 88, in NewFromJsonDict
json_data = data.copy()
AttributeError: 'str' object has no attribute 'copy'
esemeniuc commentedon Mar 19, 2019
@theelk801 You must use the return_json flag since the model hasnt been updated. Then you can manually manipulate the dict
theelk801 commentedon Mar 19, 2019
Oh, I see. Alright, I suppose that'll have to do for now. Thanks!
PythonCoderAS commentedon Mar 19, 2019
For anyone confused on how to implement the flag, it is
api.GetDirectMessages(return_json=True)where api is the TwitterApi instancepacu commentedon Aug 5, 2019
I'm getting the same error 34 when trying to get DMs from an authorized App, even when I'm using the return_json parameter. :-/
mdd423 commentedon Nov 1, 2019
I am still having the same error in accessing DMs and neither the return_json parameter nor that quick hack fix work :/
DVRodri8 commentedon Nov 26, 2019
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
PythonCoderAS commentedon Nov 27, 2019
@DVRodri8 So you mean update the package?
kevr commentedon Jun 19, 2020
Is there any kind of ETA or planning on getting this in the project?
sebastiansam55 commentedon Aug 23, 2020
This plus
return_json=Truemade it work for mechrischma commentedon Oct 9, 2021
Can you specify this?
sebastiansam55 commentedon Oct 12, 2021
@chrischma
digra1968 commentedon Feb 27, 2023
{"errors":[{"code":34,"message":"Sorry, that page does not exist."}]}