afxapicom
An unofficial async Python client for currency exchange rates.
Installation
Install from pip:
pip install afxapicom
Install from source:
pip install git+https://github.com/MrBaconHat/afxapi-python.git
Usage
All requests are made using the Client class, initialized with your API key.
import afxapicom
import asyncio
async def main():
client = afxapicom.Client('YOUR_API_KEY')
# make calls here
asyncio.run(main())
Check API Status
result = await client.status()
print(result)
Retrieve Currencies
result = await client.currencies(currencies=['EUR', 'USD'])
print(result)
Latest Exchange Rates
result = await client.latest(base_currency='USD', currencies=['EUR', 'GBP'])
print(result)
Historical Exchange Rates
result = await client.historical('2024-01-01', base_currency='USD')
print(result)
Exchange Rates Over a Range
result = await client.range('2024-01-01', '2024-01-07', base_currency='USD')
print(result)
Convert Currencies
result = await client.convert(1000, base_currency='USD', currencies=['EUR', 'GBP'])
print(result)
Error Handling
from afxapicom import Client
from afxapicom.errors import AuthenticationFailed, RateLimited, QuotaExceeded
async def main():
client = Client('YOUR_API_KEY')
try:
result = await client.latest()
print(result)
except AuthenticationFailed:
print("Invalid API key")
except RateLimited:
print("Rate limit hit, slow down")
except QuotaExceeded:
print("Monthly quota exceeded")
asyncio.run(main())
Release files for afxapicom 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| afxapicom-0.1.1.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| afxapicom-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / afxapicom-0.1.1.tar.gz
| Download URL | afxapicom-0.1.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2239233209b58adeada1355fbcafb1e74e73767ab723a4b43f5d51c9c1e091f
|
|
BLAKE2b-256 checksum How to use checksums |
f508e5f1c4f003ecb0560d4907c3badb50e1dc6a7a991b352486d7464e92249b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / afxapicom-0.1.1-py3-none-any.whl
| Download URL | afxapicom-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d2a73c922611e2107d35786d204b4454e0091779d15d04af4b735ff9cb1e7f6
|
|
BLAKE2b-256 checksum How to use checksums |
68292bde104431d946d5eabc29eeae84c5ae418949a4ce096b1f08adbbee6b7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|