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.4.tar.gz (75.0 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.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyvenezuela-0.0.4.tar.gz
  • Upload date:
  • Size: 75.0 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.4.tar.gz
Algorithm Hash digest
SHA256 bb26ca16a468189e813e96ed2e315c078f0a152d6a26fe52d906cd204c753e17
MD5 9e2df6fc219aa05316d88aea3409fa45
BLAKE2b-256 7ed35077ed13b106785469a7b609e97bbd17b9f0c3c75b1cefa277410c563c0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvenezuela-0.0.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: pyvenezuela-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cfe12ae97aaa36643029a14855addd83336cc68e30f13ae415c093177ea4868d
MD5 c79664c798827f812fa228df6aca5aac
BLAKE2b-256 6c033e14ef5e4eb0be90ceac9a9d961ab29887a87a9f5159bac86045d3a2592f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvenezuela-0.0.4-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