pytrends icon indicating copy to clipboard operation
pytrends copied to clipboard

Requests version conflicts?

Open Chrosea opened this issue 1 year ago • 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

Chrosea avatar Jun 02 '23 08:06 Chrosea

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

Chrosea avatar Jun 02 '23 08:06 Chrosea

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 https://github.com/GeneralMills/pytrends/pull/584/commits/cfb9d54518349b67086afb83afa380bc255eaedb ?

im-n1 avatar Jun 17 '23 09:06 im-n1

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: https://github.com/GeneralMills/pytrends/pull/584#issuecomment-1596226007

Terseus avatar Jun 18 '23 18:06 Terseus

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

im-n1 avatar Jul 05 '23 07:07 im-n1

Hi @im-n1,

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

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

Terseus avatar Jul 05 '23 17:07 Terseus

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

works thanks

im-n1 avatar Jul 06 '23 18:07 im-n1