Skip to main content

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?

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)

Source distribution for rate-api-python 1.1.0
File Size Uploaded
rate_api_python-1.1.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rate-api-python 1.1.0
File Interpreter ABI Platform
rate_api_python-1.1.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page