// get the data using StockTwits API
def get_twits(ticker):
url = "https://api.stocktwits.com/api/2/streams/symbol/{0}.json".format(ticker)
connection = urllib.request.urlopen(url)data = connection.read()
connection.close()
return json.loads(data)
// loops through to get data for each ticker in the tickers list
def get_twits_list(tickers):
After Change
// get the data using StockTwits API
def get_twits(ticker):
url = "https://api.stocktwits.com/api/2/streams/symbol/{0}.json".format(ticker)
response = requests.get(url).json()return response
// loops through to get data for each ticker in the tickers list
def get_twits_list(tickers):