Get Instant Access to our Exchange Rates API

Get access instantly - 1000 requests free p/m.


How To Use Our Python Currency Converter

We offer an easy to use, accurate and reliable exchange rates API for Python that's perfect for both personal and professional use.

Fetching exchange rates using our Python currency conversion API is as easy as making GET requests. This means you can easily integrate our API into your Python project however you'd prefer.

For more details on the different types of request we support please see our Main Documentation.

Alternatively simply use the Python library code below to get started with our exchange rate data as fast as you can copy & paste!

Simple Python Currency Conversion Example


import requests

# Where USD is the base currency you want to use
url = 'https://v3.exchangerate-api.com/bulk/YOUR-API-KEY/USD'

# Making our request
response = requests.get(url)
data = response.json()

# Your JSON object
print data
				

This will return the exchange rates from USD to all other currencies we support:

{
	"result": "success",
	"from": "USD",
	"rates": {
		"AUD": ((AUD in terms of USD)),
		"BGN": 1.8096,
		"BRL": 3.1143,
		"...": 1.3113,
		"...": 7.473, etc. etc.
	}
}

Please see our main documentation for further information on this query type & error response details.



We also offer automatic localization requests:



Automatic Currency Localization for Python


import cgi
import os
import urllib

# Getting visitor IP address, this may differ based on your setup
ip = os.environ["REMOTE_ADDR"]

# Making request
url = "https://v3.exchangerate-api.com/local/YOUR-API-KEY/USD/"+ip
response = requests.get(url)
data = response.json()

#If you want to display the currency's symbol in HTML:
symbol_html = ""
symbol_characters = data.currency_symbol.split(',')
for i in symbol_characters:
    symbol_html = symbol_html+"&#x"+i+";"
print symbol_html
				

This will return the exchange rate from your base currency to the visitor currency & i18n data on your visitor.

In the example API response below your prices are in USD and a customer was visiting from a Bulgarian IP address so BGN is returned as the appropriate currency for a Bulgarian visitor.

{
	"result": "success",
	"from": "USD",
	"to": "BGN",
	"country_code": "BG",
	"currency_symbol": "43b,432",
	"rate": 1.81
}

Please see our main documentation for further information on this query type & error response details.

Additionally, please email us if you'd like to submit a better code example, we'll credit you!