hongtaocai / googlefinance

Python module to get real-time stock data from Google Finance API
MIT License
713 stars 170 forks source link

problem with google finance in python 3 #36

Open helhadry opened 7 years ago

helhadry commented 7 years ago

i try to use google finance for importing stock price but i have this problem (work with python 2.x) :+1:
the json object must be str not 'bytes'

def get_value(identifier): get_value_url = 'http://finance.google.com/finance/info?client=ig&q=' + identifier value = subprocess.Popen(['curl', '-s', get_value_url], stdout=subprocess.PIPE).communicate()[0] j = json.loads(value[5:len(value)-2]) return float(j['l'])

ghost commented 7 years ago
from googlefinance import getQuotes
import json

print(getQuotes('AAPL')[0]['LastTradePrice'])