Python retrieving data from web HTTP 400: Bad Request Error (Too many Requests?) -
i using python module (googlefinance) retrieve stock information. in code, create symbols list gets sent loop collect information each symbol.
the symbols list contains 3000 indexes why think getting error. when try shortening range of loop (24 requests), works fine. have tried tried using time delay in between requests no luck. how can make can retrieve information specified symbols without getting http 400 error?
from googlefinance import getquotes import pandas pd import pymysql import time import threading import urllib.request def createsymbollist(csvfile): df = pd.read_csv(csvfile) saved_column = df['symbol'] return saved_column def getsymbolinfo(symbollist): newlist=[] in range(int(24)): newlist.append(getquotes(symbollist[i])) return newlist nyselist = createsymbollist("http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download") try: l=(getsymbolinfo(nyselist)) print(l) print(len(l)) except urllib.error.httperror err: print(err)
Comments
Post a Comment