In this Python article iam going to show you Currency Conversion With OpenExchangeRates API, so first of all you need to create an account in OpenExchangeRate Website. because in our coding we need to use the created API Key from our account in openexchangerates website. after that you need to install this API for Python Programming Language.
API Introduction
Open Exchange Rates provides a simple, lightweight and portable JSON API with live and historical foreign exchange (forex) rates, via a simple and easy-to-integrate API, in JSON format. Data are tracked and blended algorithmically from multiple reliable sources, ensuring fair and unbiased consistency. Exchange rates published through the Open Exchange Rates API are collected from multiple reliable providers, blended together and served up in JSON format for everybody to use. There are no complex queries, confusing authentication methods or long-term contracts.
Installation
openexchangerates is available on pypi repositories. just simply install by using easy_install or pip:
1 |
pip install openexchangerates |
Also you can check more Python articles in the below links
1: Complete PyQt5 GUI Development Course
2: Python TKinter GUI Development
So now this is the complete code for Python Currency Conversion With OpenExchangeRate API
1 2 3 4 5 6 7 8 |
from openexchangerate import OpenExchangeRates client = OpenExchangeRates(api_key="YOUR API KEY") print(client.currencies()) print(client.latest()) |
so you can see at the top of the code first we have imported the openexchangerate api, after that we have created the object of OpenExchangeRates and we have added our API Key in their.
Now run the complete code and this will be the result
Also you can watch the complete video for this article
Subscribe and Get Free Video Courses & Articles in your Email