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

Unexpected Keyword Argument when calling twitter.get_user_tweets() #11

Closed
shoaibiqbalk opened this issue Jul 20, 2023 · 2 comments
Closed

Comments

@shoaibiqbalk
Copy link

Get the unexpected keyword argument error when I use the following code.

from tweeterpy import TweeterPy
twitter = TweeterPy()
twitter.get_user_tweets(user_id, with_replies=True, end_cursor=None, total=2, from_date='19-07-2023', to_date='20-07-2023')

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-33-3ea1522e5413>](https://localhost:8080/#) in <cell line: 3>()
      1 # from_date = '19 July 2023'
      2 # to_date = '20 July 2023'
----> 3 tweets_by_user_id = twitter.get_user_tweets(user_id, with_replies=True, end_cursor=None, total=2, from_date='19-07-2023', to_date='20-07-2023')

[/usr/local/lib/python3.10/dist-packages/tweeterpy/tweeterpy.py](https://localhost:8080/#) in wrapper(self, *args, **kwargs)
    109             if not self.logged_in():
    110                 self.login()
--> 111             return original_function(self, *args, **kwargs)
    112         return wrapper
    113 

TypeError: TweeterPy.get_user_tweets() got an unexpected keyword argument 'from_date'
@iSarabjitDhiman
Copy link
Owner

iSarabjitDhiman commented Jul 20, 2023

Get the unexpected keyword argument error when I use the following code.

from tweeterpy import TweeterPy
twitter = TweeterPy()
twitter.get_user_tweets(user_id, with_replies=True, end_cursor=None, total=2, from_date='19-07-2023', to_date='20-07-2023')

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-33-3ea1522e5413>](https://localhost:8080/#) in <cell line: 3>()
      1 # from_date = '19 July 2023'
      2 # to_date = '20 July 2023'
----> 3 tweets_by_user_id = twitter.get_user_tweets(user_id, with_replies=True, end_cursor=None, total=2, from_date='19-07-2023', to_date='20-07-2023')

[/usr/local/lib/python3.10/dist-packages/tweeterpy/tweeterpy.py](https://localhost:8080/#) in wrapper(self, *args, **kwargs)
    109             if not self.logged_in():
    110                 self.login()
--> 111             return original_function(self, *args, **kwargs)
    112         return wrapper
    113 

TypeError: TweeterPy.get_user_tweets() got an unexpected keyword argument 'from_date'

Hey, I just noticed you are using the master branch. Make sure you clone the async-await branch first and install the requirements. from_date and to_date arguments only work with the async-await branch for now. I will merge it into the master branch soon. But for now you will have to git clone async-await branch.

Edit : Once you have tested it, let me know if it should be merged into the master branch. I am open to suggestions.

@iSarabjitDhiman
Copy link
Owner

iSarabjitDhiman commented Jul 20, 2023

Hey @shoaibiqbalk @nballen-tx
Just navigate to this async-await branch . There you should see a green button saying "Code", click on the dropdown menu just beside it. Then download the zip.
image

If are familiar with the linux file system and all, you can just extract the zip and run the code from the same directory. you may not even have to install the package, you can just import the required code into your project from the working directory.

Otherwise the easier option :

  • Remove the existing master branch package first.
pip uninstall tweeterpy
  • Extract the zip file.
  • Open cmd/powershell/terminal in the extracted directory. (The directory should have the similar files as shown in the picture)
    image
pip install setuptools
pip install -r requirements.txt
python setup.py sdist bdist_wheel

and then you should see a dist folder, you can install the package from there.
just install the latest build/version ending with .whl extension. In my case its 0.0.9

pip install .\dist\tweeterpy-0.0.9-py3-none-any.whl

Now you are good to go, you can import the package into your project as you would normally.

from tweeterpy import TweeterPy

Let me know if you still need any help.

Edit : You can uninstall it anytime and go back to master(stable) branch anytime.

pip uninstall tweeterpy
pip install tweeterpy --upgrade

Feel free to close the issue if no further queries.

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

2 participants