Python library to query Venezuela's data
Docs: https://pyvenezuela.jose2kk.com
Source Code: https://github.com/jose2kk/pyvenezuela
pyvenezuela is a Python library for querying Venezuelan public data sources, including exchange rates from the Central Bank of Venezuela (BCV) and voter data from the National Electoral Council (CNE).
- BCV exchange rates — official rates (USD, EUR, CNY, TRY, RUB) from the BCV website
- Bank rates — buy/sell rates reported by all Venezuelan banks
- CNE voter lookup — query voter registration data by ID number
- In-memory cache — automatic TTL-based caching to reduce HTTP requests
- Custom cache backends — plug in Redis, Memcached, or any other store
- Typed responses — Pydantic v2 models with full type annotations
pip install pyvenezuelaOr with uv:
uv add pyvenezuelafrom pyvenezuela import get_rates_by_bcv, BCVCurrencyEnum
rates = get_rates_by_bcv()
if rates:
print(f"USD: {rates[BCVCurrencyEnum.USD]:.4f} Bs.")
print(f"EUR: {rates[BCVCurrencyEnum.EUR]:.4f} Bs.")from pyvenezuela import get_rates_by_bank, BankEnum
import datetime
today = datetime.date.today()
last_month = today - datetime.timedelta(days=30)
rates = get_rates_by_bank(
bank=BankEnum.BANESCO,
start_date=last_month,
end_date=today,
)
for rate in rates:
print(f"{rate.date} buy: {rate.buy_rate:.4f} sell: {rate.sell_rate:.4f}")from pyvenezuela import query_id, NationalityEnum
persona = query_id(nationality=NationalityEnum.VENEZUELAN, id="12345678")
if persona:
print(f"Name: {persona.full_name}")
print(f"State: {persona.state}")
print(f"Voting center: {persona.voting_center}")# Install dependencies
uv sync --locked
# Run tests
make test
# Lint + type check
make check
# Format code
make format- Python 3.10+
- Dependencies:
beautifulsoup4,pydantic>=2,requests
MIT
