![]() |
pytrends problem - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: pytrends problem (/thread-2820.html) Pages:
1
2
|
RE: pytrends problem - Karen - Apr-14-2017 I also have found the easier one, but the pytrends package still can't work. from pytrends.pyGTrends import pyGTrends import time from random import randint def run_search(keyword): google_username = '' #Enter google username google_password = '' #Enter google password #Connect to google connector = pyGTrends(google_username, google_password) #Request a report based on keyword connector.request_report(keyword, geo = 'US', date = '03/2006 118m') print(keyword) #Wait a bit so Google doesn't block the script time.sleep(randint(5,10)) #Save a csv path = './output/' connector.save_csv(path, keyword) with open("fund name.txt", "r") as source: lines = [line.rstrip('\n').replace('/', ' ').replace(',','') for line in source] for name in lines: run_search(name) print("Finished!") |