Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Created August 16, 2020 20:57
Show Gist options
  • Save shashankvemuri/4aee6a696ef356b39d78d5c3907d9fc4 to your computer and use it in GitHub Desktop.
Save shashankvemuri/4aee6a696ef356b39d78d5c3907d9fc4 to your computer and use it in GitHub Desktop.
Start of code
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