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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -