GeneralMills/pytrends

Requests version conflicts?

Chrosea opened this issue · 6 comments

In the newer version of Requests(for me it's 2.30.0), it looks like Retry method no longer has the argument method_whitelist. I've got an error like

    retry = Retry(total=self.retries, read=self.retries,
TypeError: Retry.__init__() got an unexpected keyword argument 'method_whitelist'

According to https://stackoverflow.com/questions/65289720/attributeerror-retry-object-has-no-attribute-method-whitelist

The thing is that method_whitelist was deprecated and removed from urllib3==1.26.0 onwards

Also in pytrends/request.py, the import of retry is not valid to IDE in the newer version of urllib3.
Looks like from requests.packages.urllib3.util.retry import Retry should be from urllib3.util import Retry now

im-n1 commented

Just bumped into this. URLlib 3 indeed made that change and pretty much broke this whole library.
Any chance someone (@Terseus ) can merge this PR cfb9d54 ?

Sorry @im-n1 but there's a bug in vcrpy that prevents the test suite to work with urllib3 v2, you can follow the problem in the PR: #584 (comment)

im-n1 commented

I wonder if there are any updates? Or is there a way for temporary workaround?

Hi @im-n1,

Sorry, but Real Life™ keeps me busy right now, I'll try this weekend to check if kevin1024/vcrpy#719 made any difference, or what can we do about this.

For now the workaroud is to pin urllib3<2 in your requirements.

im-n1 commented

For now the workaroud is to pin urllib3<2 in your requirements.

works thanks