Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting tweety.exceptions.TwitterError #239

Open
saksham-joshi opened this issue Jan 23, 2025 · 6 comments
Open

getting tweety.exceptions.TwitterError #239

saksham-joshi opened this issue Jan 23, 2025 · 6 comments

Comments

@saksham-joshi
Copy link

tweety.exceptions.TwitterError: Page not Found. Most likely you need elevated authorization to access this resource.

This is the exception message which I am getting by running the code given in README.md.

  • Python version: 3.13.1
  • Tweety version: 2.1

I kindly request to fix this issue. Thank You!

@dgw
Copy link
Contributor

dgw commented Jan 23, 2025

I can't reproduce this.

$ cat tweety-test.py
from tweety import TwitterAsync
import asyncio

async def main():

    app = TwitterAsync("session")
    all_tweets = await app.get_tweets("elonmusk")
    for tweet in all_tweets:
        print(tweet)

asyncio.run(main())

$ python3 tweety-test.py
Tweet(id=1519480761749016577, author=User(id=44196397, username=elonmusk, name=Elon Musk, verified=True), created_on=2022-04-28 00:56:58+00:00)
Tweet(id=1812258574049157405, author=User(id=44196397, username=elonmusk, name=Elon Musk, verified=True), created_on=2024-07-13 22:51:28+00:00)
Tweet(id=1518623997054918657, author=User(id=44196397, username=elonmusk, name=Elon Musk, verified=True), created_on=2022-04-25 16:12:30+00:00)
<... truncated; there are dozens more>

$ pip list installed | grep tweety
tweety-ns           2.1

$ python3 -V
Python 3.13.1

@mahrtayyab
Copy link
Owner

version

Can you please post full traceback.

@saksham-joshi
Copy link
Author

version

Can you please post full traceback.

Here is the full traceback:

Traceback (most recent call last):
  File "D:\MY PROJECTS\Tweet-Analyzer\experi.py", line 3, in <module>
    app = Twitter("session")
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\bot.py", line 53, in __init__
    self.session = FileSession(self, session_name)
                   ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\session.py", line 66, in __init__
    self.session_file_path = self._get_session_file_path(session_name, self.session_name)
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\session.py", line 72, in _get_session_file_path
    directory = os.path.join(os.getenv('HOME'), 'Documents')
  File "<frozen ntpath>", line 100, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

@mahrtayyab
Copy link
Owner

version

Can you please post full traceback.

Here is the full traceback:

Traceback (most recent call last):
  File "D:\MY PROJECTS\Tweet-Analyzer\experi.py", line 3, in <module>
    app = Twitter("session")
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\bot.py", line 53, in __init__
    self.session = FileSession(self, session_name)
                   ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\session.py", line 66, in __init__
    self.session_file_path = self._get_session_file_path(session_name, self.session_name)
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\session.py", line 72, in _get_session_file_path
    directory = os.path.join(os.getenv('HOME'), 'Documents')
  File "<frozen ntpath>", line 100, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

make sure HOME enviroment variable exists.

This isn't same error you posted above.

@saksham-joshi
Copy link
Author

version

Can you please post full traceback.

Here is the full traceback:

Traceback (most recent call last):
  File "D:\MY PROJECTS\Tweet-Analyzer\experi.py", line 3, in <module>
    app = Twitter("session")
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\bot.py", line 53, in __init__
    self.session = FileSession(self, session_name)
                   ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\session.py", line 66, in __init__
    self.session_file_path = self._get_session_file_path(session_name, self.session_name)
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MY PROJECTS\Tweet-Analyzer\tweety\session.py", line 72, in _get_session_file_path
    directory = os.path.join(os.getenv('HOME'), 'Documents')
  File "<frozen ntpath>", line 100, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

make sure HOME enviroment variable exists.

This isn't same error you posted above.

"This isn't same error you posted above"----- because your API is giving me different exception every different time! I don't know what's going on. This is also happening with my friend's also.

@mahrtayyab
Copy link
Owner

os.getenv('HOME') isn't part of tweety , do you have any directory named tweety in the current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants