streamlit-unirate
Streamlit integration for the UniRate API — live exchange rates, currency conversion, and VAT rates with automatic st.cache_data / st.cache_resource caching built in.
Installation
pip install streamlit-unirate
Quick start
import streamlit as st
import streamlit_unirate as ur
# List currencies (cached 1 h)
currencies = ur.list_currencies()
from_cur = st.selectbox("From", currencies)
to_cur = st.selectbox("To", currencies)
amount = st.number_input("Amount", value=100.0)
if st.button("Convert"):
result = ur.convert(to_cur, amount, from_cur)
st.metric(f"{amount} {from_cur} →", f"{result:.4f} {to_cur}")
API key
Set UNIRATE_API_KEY in .streamlit/secrets.toml (preferred) or as an environment variable:
# .streamlit/secrets.toml
UNIRATE_API_KEY = "your_api_key_here"
UNIRATE_API_KEY=your_key streamlit run app.py
Get a free key at unirateapi.com.
API reference
All functions use Streamlit's caching automatically — no extra decorators needed.
get_client(api_key=None, base_url=None)
Returns the underlying unirate.UnirateClient singleton (cached via @st.cache_resource). Use this when you need direct access to Pro endpoints such as historical rates or time series.
client = ur.get_client()
data = client.get_time_series("2025-01-01", "2025-01-31", base_currency="USD")
get_rate(from_currency="USD", to_currency=None) → float | dict
Current exchange rate. Cached for 5 minutes.
rate = ur.get_rate("USD", "EUR") # → 0.9214 (float)
all_rates = ur.get_rate("USD") # → {"EUR": 0.92, "GBP": 0.79, ...}
convert(to_currency, amount=1.0, from_currency="USD") → float
Convert an amount. Cached for 5 minutes.
eur = ur.convert("EUR", 250.0, "USD") # → 230.35
list_currencies() → list[str]
All supported currency codes. Cached for 1 hour.
codes = ur.list_currencies() # → ["AED", "AFN", ..., "ZWL"]
get_vat_rates(country=None) → dict
VAT rates for all countries or a single ISO-3166 country code. Cached for 24 hours.
all_vat = ur.get_vat_rates()
de_vat = ur.get_vat_rates("DE")
Error handling
All functions raise exceptions from unirate.exceptions:
| Exception | Cause |
|---|---|
AuthenticationError |
Missing or invalid API key |
RateLimitError |
Free-tier rate limit exceeded |
InvalidCurrencyError |
Unknown currency code |
APIError |
Other API error (check .status_code) |
from unirate.exceptions import RateLimitError, AuthenticationError
import streamlit_unirate as ur
try:
rate = ur.get_rate("USD", "EUR")
except AuthenticationError:
st.error("Check your UNIRATE_API_KEY.")
except RateLimitError:
st.warning("Rate limit hit — try again in a moment.")
Related UniRate clients
Other UniRate integrations: Python · Node.js · Go · Rust · Ruby · PHP · Java · Swift · .NET · FastAPI · Flask · Django REST · Wagtail · Next.js · Nuxt · SvelteKit · React · Vue · Angular · Remix · NestJS · LangChain (Python) · LangChain.js · Astro · Eleventy · Hugo · Jekyll · Strapi · Directus · Medusa · MCP Server · CLI
License
MIT — see LICENSE.
Metadata
Release files for streamlit-unirate 0.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 | |
|---|---|---|---|
| streamlit_unirate-0.1.0.tar.gz | 129.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_unirate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 134.9 kB
Release files / streamlit_unirate-0.1.0.tar.gz
| Download URL | streamlit_unirate-0.1.0.tar.gz |
|---|---|
| Size | 129.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c76e08f1015503f33bb285357bd06610f4f64f5262d905e8e4acdc6c30ff926
|
|
BLAKE2b-256 checksum How to use checksums |
a1de3c7d5b7ea5c28b1337730441f768c76a6e3c5c4ab8b7516a83f7dd59f5c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / streamlit_unirate-0.1.0-py3-none-any.whl
| Download URL | streamlit_unirate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81fc85b08fcdfdeb2e55020bcd68cf5099951097c0e6e82d7d6523fdc80a4e22
|
|
BLAKE2b-256 checksum How to use checksums |
adaae90a0ca71dd1acd56b5b68fd5ed9a62a0ddee1bde24cd5bbc85b6161e555
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency log