I am trying to write a program that will help me with accounting work. I am trying to pull information by using stock prices for companies over time. I am utilizing urllib.request to read and open URLs, but I can't get around this 404 issue, despite the URL existing. Any help would be appreciated.
I have tried changing the import statement to:
import urllib.request as ur
so that I can also try:
read_data = ur.urlopen(url_is).read()
soup_is = BeautifulSoup(read_data, 'lxml')
but that came up with the same error.
To extract historical market data in 4 lines you can use
yfinancepackage.Check code in the online IDE.
Output:
Also in your case, the problem may be due to the fact that your request is blocked.
You can read Reducing the chance of being blocked while web scraping blog post to figure out how to bypass these blocks.