rate-api-python
Official Python client for Rate-API.com. Standard library only — no dependencies. Python 3.8+.
Install
pip install rate-api-python
Usage
from rate_api import RateApiClient, RateApiError
client = RateApiClient("YOUR_API_KEY")
rates = client.latest("USD", ["EUR", "GBP"])
print(rates["rates"]["EUR"])
client.convert("USD", "EUR", 100) # Pro+
client.historical("2026-01-15", "USD", ["EUR"]) # Pro+
client.pair("USD", "EUR") # single pair
client.crypto(["BTC", "ETH"]) # Pro+
client.currencies() # supported currencies
client.usage() # current-month usage vs quota
client.health() # public
try:
client.convert("USD", "ZZZ", 100)
except RateApiError as e:
print(e, e.status) # "Invalid target currency" 400
Methods
latest · convert · pair · historical · crypto · currencies · usage · quota · health
Errors
Every failure raises RateApiError (or a subclass), so a single except RateApiError catches everything:
import time
from rate_api import RateApiClient, RateApiError, RateLimitError, RateApiTimeoutError
try:
client.latest("USD", ["EUR"])
except RateLimitError as e:
time.sleep(e.retry_after) # honour the server's backoff
except RateApiTimeoutError:
... # request exceeded `timeout`
except RateApiError as e:
print(e, e.status, e.type, e.request_id)
| Class | When | Extra attributes |
|---|---|---|
RateApiError |
any API/HTTP error | status (HTTP code; None on network/timeout), type (stable error.type slug), request_id (X-Request-Id — quote it when contacting support) |
RateLimitError |
HTTP 429 | retry_after (seconds to wait) |
RateApiTimeoutError |
request exceeded timeout |
— |
Configuration
RateApiClient(api_key, base_url="https://rate-api.com/api/v1", timeout=15, max_retries=2)
| Argument | Default | Notes |
|---|---|---|
base_url |
https://rate-api.com/api/v1 |
pass …/api/v2 to target v2 directly |
timeout |
15 |
per-request socket timeout in seconds (covers headers and body) |
max_retries |
2 |
automatically retries 429/503/network/timeout with exponential backoff, honouring the server's Retry-After header |
License
MIT
Stocks, metals and key status (Pro plan and up)
client.stocks(["AAPL", "MSFT"]) # latest closes, USD
client.metals(["XAU", "XAG"]) # per troy ounce, USD
client.status() # is this key still good?
Metadata
Release files for rate-api-python 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rate_api_python-1.1.0.tar.gz | 5.6 kB | Without provenance | Details for rate_api_python-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rate_api_python-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for rate_api_python-1.1.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / rate_api_python-1.1.0.tar.gz
| Download URL | rate_api_python-1.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d54d9f065a1f48ef0de71eccc0bf81d486bcbfea45dd80fb88a58dea060fb44
|
|
BLAKE2b-256 checksum How to use checksums |
3bb83ae5dbba0037e38c504304cba8511081463d5da0acc196fac05a0609a138
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / rate_api_python-1.1.0-py3-none-any.whl
| Download URL | rate_api_python-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
515c18415e47f4c20cbba8dcb771e087a7358621510a80f49375bbda4fafd53e
|
|
BLAKE2b-256 checksum How to use checksums |
3cfd81a0881b20d61403e46a49d3557cc44ba48a0fd2423988cc9a04f4797da3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for rate-api-python 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.