jsonrates + currencylayer  Read more

We're happy to announce that the jsonrates API has been integrated into the currencylayer API.
You can continue using our API for free by signing up here ยป

Important: This documentation has been deprecated and is no longer valid. For detailed reference about API integration, usage guides and language examples please visit: currencylayer.com/documentation

Python code examples

The following code examples demonstrate the Python interaction with the API.
All examples also expect your API key.


Example 1
Get the exchange rate between two currencies
import requests

response = requests.get(
    'http://jsonrates.com/get/?'+
    'from=USD'+
    '&to=EUR'
)
json = response.json()
rate = float(json['rate'])
Example 2
Convert an amount from one into another currency
import requests

response = requests.get(
    'http://jsonrates.com/convert/?'+
    'from=USD'+
    '&to=EUR'+
    '&amount=2.99'
)
json = response.json()
amount = float(json['amount'])
Example 3
Get historical exchange rates between two currencies for three days
import requests

response = requests.get(
    'http://jsonrates.com/historical/?'+
    'from=USD'+
    '&to=EUR'+
    '&dateStart=2014-06-25'+
    '&dateEnd=2014-06-27'
)
json = response.json()

for date, values in json['rates'].iteritems():
    histrate = float(values['rate'])