GeneralMills / pytrends

Pseudo API for Google Trends
Other
3.12k stars 798 forks source link

Requests version conflicts? #583

Open Chrosea opened 1 year ago

Chrosea commented 1 year ago

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 commented 1 year ago

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 1 year ago

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 ?

Terseus commented 1 year ago

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

im-n1 commented 12 months ago

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

Terseus commented 12 months ago

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.

im-n1 commented 12 months ago

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

works thanks