Created
August 16, 2020 20:57
-
-
Save shashankvemuri/4aee6a696ef356b39d78d5c3907d9fc4 to your computer and use it in GitHub Desktop.
Start of code
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
import pandas as pd | |
import numpy as np | |
from bs4 import BeautifulSoup as soup | |
from urllib.request import Request, urlopen | |
pd.set_option('display.max_colwidth', 25) | |
# Input | |
symbol = input('Enter a ticker: ') | |
print ('Getting data for ' + symbol + '...\n') | |
# Set up scraper | |
url = ("http://finviz.com/quote.ashx?t=" + symbol.lower()) | |
req = Request(url, headers={'User-Agent': 'Mozilla/5.0'}) | |
webpage = urlopen(req).read() | |
html = soup(webpage, "html.parser") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment