Retrieve Currency Exchange Rates in Python

Growth in online commerce requires system-wide understanding of and compatibility with international currency. The following API will show you how to add a list of currency exchange rates to a desired application using Python. This list will return the ISO Currency Code, currency symbol, name, country, country codes, and EU membership status.

Image for post
Image for post

Our first step is to install our Python SDK:

pip install cloudmersive-currency-api-client

Then, we can call our function:

from __future__ import print_function
import time
import cloudmersive_currency_api_client
from cloudmersive_currency_api_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_currency_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_currency_api_client.CurrencyExchangeApi(cloudmersive_currency_api_client.ApiClient(configuration))
try:
# Get a list of available currencies and corresponding countries
api_response = api_instance.currency_exchange_get_available_currencies()
pprint(api_response)
except ApiException as e:
print("Exception when calling CurrencyExchangeApi->currency_exchange_get_available_currencies: %s\n" % e)

With that, you can easily access and track exchange rate data within your organization’s programs. You can retrieve your free API Key from the Cloudmersive website. This will give you access to 800 monthly calls across our library of APIs.

Written by

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store