Get the Currency of an Input Country in Python

If your application deals with foreign currency in any capacity, you’ll probably want an easy way to confirm what currency a given country uses. The Cloudmersive Validate API is perfect for that — with the /validate/address/country/get-currency iteration, you can capture a country name as an input & receive the ISO three-letter country code, currency symbol, and English currency name in the blink of an eye. It’s easy to connect with in 13+ programming languages, and in this article, we’ll walk through how to connect in Python.

To begin the process, you can start by copying the below Python SDK Installation command:

pip install cloudmersive-validate-api-clientfrom __future__ import print_function
import time
import cloudmersive_validate_api_client
from cloudmersive_validate_api_client.rest import ApiException
from pprint import pprint

After that, you’ll need to authenticate your API key with the below code snippet:

# Configure API key authorization: Apikey
configuration = cloudmersive_validate_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'

If you don’t already have a Cloudmersive API key, you can get one easily by making a free account on the Cloudmersive website (which includes 800 api calls per month).

For the last step in the function, you can now copy & paste the remaining code:

# create an instance of the API class
api_instance = cloudmersive_validate_api_client.AddressApi(cloudmersive_validate_api_client.ApiClient(configuration))
input = cloudmersive_validate_api_client.ValidateCountryRequest() # ValidateCountryRequest | Input request
try:
# Get the currency of the input country
api_response = api_instance.address_get_country_currency(input)
pprint(api_response)
except ApiException as e:
print("Exception when calling AddressApi->address_get_country_currency: %s\n" % e)

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Assembly: Accumulate Blockchain Hackathon

READ/DOWNLOAD* Analysis and Design of Energy Systems FULL BOOK PDF & FULL AUDIOBOOK

Hacking Series Part 10

~*PDF $^EPub[READ] Coding Games in Scratch: A Step-by-Step Visual Guide to Building Your Own…

Linux Remote CLI Flutter Mobile App _ CGI With Firebase Stream Builder.[Task 4]

Data Base Job Roles

Redhat Webinar on Ansible use cases

8 Best free CRM software Reviews 2019

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
Cloudmersive

Cloudmersive

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

More from Medium

Generate a EAN-8 code barcode as PNG file in Python

Python subclassing and dependency inversion without violating Liskov substitution

ESP32 Project 6: I²C Communication

Multi Threading in Python

Why Python needs the GIL