eccentric blog

[ Home | RSS 2.0 | ATOM 1.0 ]

Fri, 23 Jun 2017

getting canadian exchange rates in python

Simple script to get the current exchange rates from the bank of canada:

import requests

r = requests.get('http://www.bankofcanada.ca/valet/observations/group/FX_RATES_DAILY/json')
rates = r.json()
date = rates['observations'][-1]['d']
rate = rates['observations'][-1]['FXUSDCAD']['v']

posted at: 12:23 | path: /python | permanent link to this entry

Made with Pyblosxom