Skip to content

jose2kk/pyvenezuela

pyvenezuela

Python library to query Venezuela's data

CI Package version Supported Python versions


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).

Features

  • 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

Installation

pip install pyvenezuela

Or with uv:

uv add pyvenezuela

Quick Start

BCV Exchange Rates

from 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.")

Bank Rates

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}")

CNE Voter Lookup

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}")

Development

# Install dependencies
uv sync --locked

# Run tests
make test

# Lint + type check
make check

# Format code
make format

Requirements

  • Python 3.10+
  • Dependencies: beautifulsoup4, pydantic>=2, requests

License

MIT

About

Python library to query Venezuela's data (BCV exchange rates, bank rates, CNE voter lookup)

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors