Skip to main content

Python library to query Venezuela's data (BCV and CNE)

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvenezuela-0.0.5.tar.gz (80.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyvenezuela-0.0.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file pyvenezuela-0.0.5.tar.gz.

File metadata

  • Download URL: pyvenezuela-0.0.5.tar.gz
  • Upload date:
  • Size: 80.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyvenezuela-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9478ea7cbfdd7361cbf188b358c770f51e163023a8bb401c98edd09a49996069
MD5 cbe5e3c8adaa2c1f7389cdd338217b35
BLAKE2b-256 a582a3347a08a21e287a8f9b55fc99b36310be0a366f2deb934557978e1ae9a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvenezuela-0.0.5.tar.gz:

Publisher: publish.yml on jose2kk/pyvenezuela

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvenezuela-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyvenezuela-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyvenezuela-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6b5cbdb20ac1a05611426ad78fe9a99ed3c96624649675a4d44d19cfe73e4329
MD5 2e84622b27d1cc01c649c8d2bc655a60
BLAKE2b-256 392c41bb5bb6ece2dcea712bf937c4cf2b7be0314139943570d63af8c06c44ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvenezuela-0.0.5-py3-none-any.whl:

Publisher: publish.yml on jose2kk/pyvenezuela

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page