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

Adapt the HTTP calls to the latest changes in Google Trends API #570

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pytrends/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def GetGoogleCookie(self):
if "proxies" in self.requests_args:
try:
return dict(filter(lambda i: i[0] == 'NID', requests.get(
f'{BASE_TRENDS_URL}/?geo={self.hl[-2:]}',
f'{BASE_TRENDS_URL}/explore/?geo={self.hl[-2:]}',
timeout=self.timeout,
**self.requests_args
).cookies.items()))
Expand All @@ -86,7 +86,7 @@ def GetGoogleCookie(self):
proxy = ''
try:
return dict(filter(lambda i: i[0] == 'NID', requests.get(
f'{BASE_TRENDS_URL}/?geo={self.hl[-2:]}',
f'{BASE_TRENDS_URL}/explore/?geo={self.hl[-2:]}',
timeout=self.timeout,
proxies=proxy,
**self.requests_args
Expand Down Expand Up @@ -194,7 +194,7 @@ def _tokens(self):
# make the request and parse the returned json
widget_dicts = self._get_data(
url=TrendReq.GENERAL_URL,
method=TrendReq.GET_METHOD,
method=TrendReq.POST_METHOD,
params=self.token_payload,
trim_chars=4,
)['widgets']
Expand Down
830 changes: 67 additions & 763 deletions tests/cassettes/test_request/test_build_payload.yaml

Large diffs are not rendered by default.

745 changes: 24 additions & 721 deletions tests/cassettes/test_request/test_initial_data.yaml

Large diffs are not rendered by default.

1,009 changes: 155 additions & 854 deletions tests/cassettes/test_request/test_interest_by_region_city_resolution.yaml

Large diffs are not rendered by default.

947 changes: 125 additions & 822 deletions tests/cassettes/test_request/test_interest_by_region_ok.yaml

Large diffs are not rendered by default.

745 changes: 24 additions & 721 deletions tests/cassettes/test_request/test_interest_over_time_bad_gprop.yaml

Large diffs are not rendered by default.

853 changes: 78 additions & 775 deletions tests/cassettes/test_request/test_interest_over_time_froogle.yaml

Large diffs are not rendered by default.

853 changes: 78 additions & 775 deletions tests/cassettes/test_request/test_interest_over_time_images.yaml

Large diffs are not rendered by default.

853 changes: 78 additions & 775 deletions tests/cassettes/test_request/test_interest_over_time_news.yaml

Large diffs are not rendered by default.

853 changes: 78 additions & 775 deletions tests/cassettes/test_request/test_interest_over_time_ok.yaml

Large diffs are not rendered by default.

1,012 changes: 157 additions & 855 deletions tests/cassettes/test_request/test_interest_over_time_partial.yaml

Large diffs are not rendered by default.

853 changes: 78 additions & 775 deletions tests/cassettes/test_request/test_interest_over_time_youtube.yaml

Large diffs are not rendered by default.

796 changes: 78 additions & 718 deletions tests/cassettes/test_request/test_multirange_interest_over_time_ok.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5,384 changes: 2,065 additions & 3,319 deletions tests/cassettes/test_request/test_realtime_trending_searches_ok.yaml

Large diffs are not rendered by default.

916 changes: 109 additions & 807 deletions tests/cassettes/test_request/test_related_queries_result_keys.yaml

Large diffs are not rendered by default.

916 changes: 109 additions & 807 deletions tests/cassettes/test_request/test_related_queries_result_rising.yaml

Large diffs are not rendered by default.

917 changes: 110 additions & 807 deletions tests/cassettes/test_request/test_related_queries_result_top.yaml

Large diffs are not rendered by default.

862 changes: 82 additions & 780 deletions tests/cassettes/test_request/test_related_topics_result_keys.yaml

Large diffs are not rendered by default.

862 changes: 82 additions & 780 deletions tests/cassettes/test_request/test_related_topics_result_rising.yaml

Large diffs are not rendered by default.

862 changes: 82 additions & 780 deletions tests/cassettes/test_request/test_related_topics_result_top.yaml

Large diffs are not rendered by default.

764 changes: 33 additions & 731 deletions tests/cassettes/test_request/test_suggestions_ok.yaml

Large diffs are not rendered by default.

829 changes: 66 additions & 763 deletions tests/cassettes/test_request/test_tokens.yaml

Large diffs are not rendered by default.

754 changes: 28 additions & 726 deletions tests/cassettes/test_request/test_top_charts_ok.yaml

Large diffs are not rendered by default.

1,389 changes: 358 additions & 1,031 deletions tests/cassettes/test_request/test_trending_searches_ok.yaml

Large diffs are not rendered by default.

162 changes: 82 additions & 80 deletions tests/test_request.py

Large diffs are not rendered by default.