Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
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

Open

Description

@PythonCoderAS

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?

Activity

  1. esemeniuc commented on Feb 13, 2019

    @esemeniuc

    +1 have this problem

  2. PythonCoderAS commented on Feb 13, 2019

    @PythonCoderAS
    Author
  3. esemeniuc commented on Feb 13, 2019

    @esemeniuc
  4. theelk801 commented on Mar 19, 2019

    @theelk801

    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'

  5. esemeniuc commented on Mar 19, 2019

    @esemeniuc

    @theelk801 You must use the return_json flag since the model hasnt been updated. Then you can manually manipulate the dict

  6. theelk801 commented on Mar 19, 2019

    @theelk801

    Oh, I see. Alright, I suppose that'll have to do for now. Thanks!

  7. PythonCoderAS commented on Mar 19, 2019

    @PythonCoderAS
    Author

    For anyone confused on how to implement the flag, it is api.GetDirectMessages(return_json=True) where api is the TwitterApi instance

  8. pacu commented on Aug 5, 2019

    @pacu

    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. :-/

  9. mdd423 commented on Nov 1, 2019

    @mdd423

    I am still having the same error in accessing DMs and neither the return_json parameter nor that quick hack fix work :/

  10. DVRodri8 commented on Nov 26, 2019

    @DVRodri8

    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

  11. PythonCoderAS commented on Nov 27, 2019

    @PythonCoderAS
    Author

    @DVRodri8 So you mean update the package?

  12. kevr commented on Jun 19, 2020

    @kevr

    Is there any kind of ETA or planning on getting this in the project?

  13. sebastiansam55 commented on Aug 23, 2020

    @sebastiansam55

    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

  14. chrischma commented on Oct 9, 2021

    @chrischma

    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

    Can you specify this?

  15. sebastiansam55 commented on Oct 12, 2021

    @sebastiansam55

    For anyone confused on how to implement the flag, it is api.GetDirectMessages(return_json=True) where api is the TwitterApi instance

    @chrischma

  16. digra1968 commented on Feb 27, 2023

    @digra1968

    {"errors":[{"code":34,"message":"Sorry, that page does not exist."}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions