probleme avec API google finance avec python 3.x
Bonjour tous le monde,
j'ai un probleme avec les API google finance ( ça marche très bien avec python 2.x) , je pense qu'il y a des changements dans python 3.x
voila le code qui me donne un erreur : TypeError: the JSON object must be str, not 'bytes'
Code:
1 2 3 4 5 6
|
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']) |
Merci.