Accessing Nasdaq Historical Data With Python Requests Results In Connection Timeout
I tried to run this snippet of Python code (with the requests library) to retrieve a year's worth of Tesla's historical market data from NASDAQ.com dataURL = https://www.nasdaq.com
Solution 1:
Try by adding these three headers:
"Accept-Language":"en-US,en;q=0.9""Accept-Encoding":"gzip, deflate, br""User-Agent":"Java-http-client/"
Solution 2:
Here is a simple solution with using Selenium chromedriver.
import time
from selenium importwebdriverdataURL='https://www.nasdaq.com/api/v1/historical/TSLA/stocks/2019-05-22/2020-05-21'
driver = webdriver.Chrome('C:/chromedriver.exe')
driver.get(dataURL)
time.sleep(5)
driver.quit()
Again, check with the provider for terms on proper scraping. You can look into more of selenium chromewebdriver, https://chromedriver.chromium.org/getting-started
Post a Comment for "Accessing Nasdaq Historical Data With Python Requests Results In Connection Timeout"