Last active
March 1, 2021 19:31
-
-
Save pixyfox/2785b2eac1f555aaa1c04a0bf3d45c39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redo searches with errors | |
if len(errors_list) > 0: | |
print('\nStart errors:') | |
for t in range(1,loops+1): | |
if len(errors_list) > 0: | |
print('Loop ', t, ': ', len(errors_list), 'errors') | |
for i in errors_list: | |
g = i[0] # 1st element geo | |
k = i[1] # 2nd element keyword | |
try: | |
time.sleep(wait) | |
pytrends.build_payload([k], timeframe='all', | |
geo=g, gprop='') | |
trends[g][k] = pytrends.interest_over_time()[k] | |
errors_list.remove([g,k]) # remove from list of errors | |
#print('Success: ', g, k) | |
except: | |
#print('*** Error: ', g, ' & ', k) | |
pass | |
print('\nDone -', len(errors_list), 'errors left') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment