iSarabjitDhiman / TweeterPy

TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc.
MIT License
123 stars 17 forks source link

TypeError: Client.__init__() got an unexpected keyword argument 'follow_redirects' #18

Closed shoaibiqbalk closed 11 months ago

shoaibiqbalk commented 11 months ago

The code gives the following error. code: twitter = TweeterPy() error:

`File ~/miniconda3/envs/tweeterpy_env/lib/python3.11/site-packages/tweeterpy/tweeterpy.py:18, in TweeterPy.__init__(self)
     17 def __init__(self):
---> 18     self.generate_session()
     19     # update api endpoints
     20     ApiUpdater()

File ~/miniconda3/envs/tweeterpy_env/lib/python3.11/site-packages/tweeterpy/tweeterpy.py:97, in TweeterPy.generate_session(self, auth_token)
     95 ssl_verify = False if proxies else True
     96 timeout = config.TIMEOUT or 10
---> 97 self.session = httpx.Client(
     98     follow_redirects=True, timeout=timeout, proxies=proxies, verify=ssl_verify)
     99 self.session.headers.update(util.generate_headers())
    100 make_request(Path.BASE_URL, session=self.session)

TypeError: Client.__init__() got an unexpected keyword argument 'follow_redirects'`
iSarabjitDhiman commented 11 months ago

Make sure you have installed all the dependencies from the requirements.txt and also match the httpx package version. Let me know if the issue still persists.

shoaibiqbalk commented 11 months ago

It was working till Tuesday and now it doesn't.

iSarabjitDhiman commented 11 months ago

It was working till Tuesday and now it doesn't.

You might have updated or downgraded some libraries recently. Try this:

Fix 1:

pip install httpx==0.24.1

Fix 2: try reinstalling the dependenices.

pip install -r requirements.txt

If it still doesn't work, you can try installing it in some virtual environment.

iSarabjitDhiman commented 11 months ago

I assume its working for you now, so I am going to close the issue. If the problem still persists, feel free to reopen the issue.