Python requests to get Yahoo finance data -


i'm trying use yahoo finance api python 2.7 , requests.

entering in url returns data need without issue.

url - http://chartapi.finance.yahoo.com/instrument/1.0/bhp.ax/chartdata;type=quote;range=1d/csv

returns

timestamp,close,high,low,open,volume 1443571254,21.8800,21.8900,21.8400,21.8550,773600 1443571319,21.9000,21.9000,21.8400,21.8800,63900 1443571379,21.9200,21.9200,21.8700,21.8800,68800 1443571436,21.9350,21.9500,21.9000,21.9200,16700 

but, when try same python eg.

import requests r = requests.get('http://chartapi.finance.yahoo.com/instrument/1.0/bhp.ax/chartdata;type=quote;range=1d/csv') print r 

i connectionerror.

i can't understand how browser return result, when requests times out.

ok, simple answer using http in python, api wanted https. explained in answer here.

python requests.exception.connectionerror: connection aborted "badstatusline"


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -