This library uses the api functionality of ExchangeRateApi, it will make use of the request library in order to make the requests from the ExchangeRateApi.
Project description
Exchange Rate Api
ExchangeRateApi is an unofficial python library which allows to use the api functionality of ExchangeRateApi, it will make use of the request library in order to make the requests from the ExchangeRateApi.
Installation
Use the package manager pip to install Exchange Rate Api
pip install exchangerateapi
Usage
The ExchangeRateApi takes 1 argument
# Initialize an object to ExchangeRateApi
from ExchangeRateApi import *
api = ExchangeRateApi("YOUR_API_KEY")
There are 7 methods
- get_latest
- get_pair_conversion
- get_codes
- get_quota
- get_enriched_data
- get_historical_data
- search
from ExchangeRateApi import *
import pprint
api = ExchangeRateApi("YOUR_API_KEY")
pprint.pprint(api.get_latest("INR")) # get_latest method returns a dictionary
print(api.get_pair_conversion("INR", "USD", 2.0)) # get_pair_conversion returns a string
pprint.pprint(api.get_codes()) # get_codes returns a dictionary
print(api.get_quota()) # get_quota returns a string
print(api.get_enriched_data("INR","USD")) # get_enriched_data returns a string
pprint.pprint(api.get_historical_data("INR",20,12,2000,2.0)) # get_historical_data returns a dictionary
api.search("in") # returns a dictionary if is_print is False
Features
-
Exception
New exceptions has been included
- InvalidKeyError
- InactiveAccountError
- QuotaExceededError
- UnsupportedCodeError
- MalformedRequestError
- PlanUpgradeRequiredError
- NoDataAvailableError
- CliFormatError
- NoArgumentError
-
Command Line Interface
Command line interface has been added to this package
usage: ExchangeRateApi [-h] -k KEY [-q QUOTA] [-l LATEST] [-c CURRENCY] [-p [PAIR [PAIR ...]]] [-e ENRICHED ENRICHED] [-H [HISTORICAL [HISTORICAL ...]]]
[-s [SEARCH [SEARCH ...]]]
This library will allow the user to use the api functionality of ExchangeRateApi, it will make use of the request library in order to make the requests from
the ExchangeRateApi.
optional arguments:
-h, --help show this help message and exit
-k KEY, --key KEY Api key for the ExchangeRateApi
-q QUOTA, --quota QUOTA
Gives the quota for the api key
-l LATEST, --latest LATEST
Gives the latest exchange rate of the currency
-c CURRENCY, --currency CURRENCY
Gives the supported codes
-p [PAIR [PAIR ...]], --pair [PAIR [PAIR ...]]
Converts the first currency to the second currency and if any amount is given it will be converted to the specified amount Format -
Currency Currency Amount = 1
-e ENRICHED ENRICHED, --enriched ENRICHED ENRICHED
Converts the first currency to the second currency and if any amount is given it will be converted to the specified amount and gives
the enriched data The information contains : - Country - Two-Letter Code - Currency Name - Currency Name short - Symbol - Flag Url
Format - Currency Currency
-H [HISTORICAL [HISTORICAL ...]], --historical [HISTORICAL [HISTORICAL ...]]
Gives the historical data of the currency and users should provide date, month and year Format - Currency Date Month Year Amount = 1
-s [SEARCH [SEARCH ...]], --search [SEARCH [SEARCH ...]]
Searches for the currency codes in order to give the valid currency code Format - Key is_country=0 Provide is_country as 1 if you
want to get the currency code for the country else leave it empty
Test cases has been included
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ExchangeRateApi-0.1.0.tar.gz
.
File metadata
- Download URL: ExchangeRateApi-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94ce3438939ce59c4e52ea66188b1f24e0baaf5f6fa6687490e0b3471cd78568 |
|
MD5 | dabc8661b1ee42880dfd88a0e6fe1ee0 |
|
BLAKE2b-256 | c0c3c9883308525a1ea03a5db4db8f4df16e28235c48ee7093579a48e8611230 |
File details
Details for the file ExchangeRateApi-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ExchangeRateApi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 965daf39d87945c97b5d0a7838ffd8c58e7b118c8e734e9049210b356c96e9fb |
|
MD5 | 4075ba7af447b772cdae957417aed547 |
|
BLAKE2b-256 | 77a7dda61ed9b6b2f322a9a8cfdf3ca791314d502cff7bd890943f697511b206 |