bigdata-corp-api
Python client library for BigDataCorp API endpoints used in Murabei data enrichment and due-diligence workflows.
Objective and motivation
This package wraps BigDataCorp REST endpoints behind a typed Python API with domain-specific exceptions and dataset discovery helpers.
Why this exists
Murabei services query BigDataCorp for CPF, CNPJ, and process data during enrichment pipelines. A shared client avoids duplicating authentication, retry logic, and error mapping across workers and applications.
How it is used
Install the package in workers or apps that call BigDataCorp during batch or
on-demand enrichment. Instantiate BigDataCorpAPI with an auth token, then
call dataset list or fetch methods.
Scope
Owns HTTP communication, dataset constants, exception types, retry and pagination, parallel batch fetches, usage reporting, local CPF, CNPJ, and CNJ checks, and certificate file downloads from on-demand responses. Credential storage, orchestration, and downstream persistence live in consuming services.
Install
From PyPI (when published):
pip install bigdata-corp-api
From a built wheel or sdist:
pip install dist/bigdata_corp_api-*.whl
From source (requires Poetry):
pip install poetry
export VERSION=$(grep -E '^VERSION=' VERSION | cut -d'=' -f2-)
sed -e 's#{VERSION}#'"${VERSION}"'#g' pyproject_template.toml > pyproject.toml
poetry build
pip install dist/bigdata_corp_api-*.whl
Quick start
from bigdatacorp_api.data import BigDataCorpAPI
api = BigDataCorpAPI(bigdata_auth_token="YOUR_TOKEN")
# List available CPF datasets
datasets = api.list_cpf_dataset()
# Fetch one dataset
result = api.get_cpf_dataset(
cpf="52998224725",
dataset="basic_data",
)
# Append dataset_params to the Datasets field
result = api.get_cnpj_dataset(
cnpj="00000000000191",
dataset="processes",
dataset_params="{NextPageId}.limit(500)",
)
# Fetch multiple datasets in parallel
batch = api.get_cpf_datasets(
cpf="52998224725",
datasets=["basic_data", "occupation_data"],
)
# Soft-fail non-critical errors; per-dataset q and Datasets suffixes
batch = api.get_cpf_datasets(
cpf="52998224725",
datasets=["basic_data", "processes"],
skip_errors=True,
query_params={"processes": ", returnupdates{false}"},
dataset_params={"processes": "{NextPageId}.limit(500)"},
)
# Soft failures are under batch["__errors__"]
CNPJ and process queries follow the same pattern via list_cnpj_dataset,
get_cnpj_dataset, list_process_dataset, and get_process_dataset.
Fetch methods check CPF, CNPJ, and CNJ numbers locally and raise
BigDataCorpAPIInvalidDocumentException before the HTTP call.
Batch helpers accept skip_errors, a query_params mapping (suffix for
q), and a dataset_params mapping (suffix for Datasets).
Usage reporting for a date range:
usage = api.get_usage(
initial_date="2025-01-01",
final_date="2025-01-31",
)
Download a certificate file from an on-demand dataset response:
cert_response = api.get_cpf_dataset(
cpf="52998224725",
dataset="ondemand_cert_debt_absence_by_state_person",
)
file_data = api.get_result_file(
dataset="ondemand_cert_debt_absence_by_state_person",
json_data=cert_response,
)
# file_data["file_type"] and file_data["file_content"]
Configuration
The auth token is passed to BigDataCorpAPI at construction time.
Timeout, batch parallelism, and the pagination page cap are read from
the environment when set. A blank value keeps the default. Any other
value must be a positive integer.
| Variable | Required | Description |
|---|---|---|
BIGDATACORP__REQUEST_TIMEOUT |
No | HTTP timeout in seconds (default 60) |
BIGDATACORP__N_PARALLEL |
No | Max threads for batch fetches (default 8) |
BIGDATACORP__MAX_PAGES |
No | Extra pages after the first (default 200) |
BIGDATA_AUTH_TOKEN |
Tests | Token for integration tests |
TEST_CPF |
Tests | Valid CPF for integration tests |
TEST_CNPJ |
Tests | Valid CNPJ for integration tests |
Development
Build a release (bumps patch in VERSION, renders pyproject.toml, tags,
and pushes):
./build.sh
Run tests (integration tests call the live API when env vars are set):
export BIGDATA_AUTH_TOKEN="your-token"
export TEST_CPF="valid-cpf"
export TEST_CNPJ="valid-cnpj"
python -m unittest discover -s src/bigdatacorp_api/tests
Lint with Ruff (configuration in pyproject.toml):
ruff check src/
CI on main builds from VERSION and pyproject_template.toml, then
publishes to PyPI when PYPI_API_TOKEN is configured.
License
BSD-3-Clause — see LICENSE.
Metadata
Release files for bigdata-corp-api 0.18.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bigdata_corp_api-0.18.9.tar.gz | 23.0 kB | Without provenance | Details for bigdata_corp_api-0.18.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bigdata_corp_api-0.18.9-py3-none-any.whl | Python 3 | none | any | Details for bigdata_corp_api-0.18.9-py3-none-any.whl |
Total release size: 52.7 kB
Release files / bigdata_corp_api-0.18.9.tar.gz
| Download URL | bigdata_corp_api-0.18.9.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
650be126987c8ad6386bf0c733bcb56c8f2e55cdec2b341f283c4b77d0b218c6
|
|
BLAKE2b-256 checksum How to use checksums |
2b8fde0c5ccb82f440fe4a591a4726ed1987c21d9e13f26325edaf2e0484fc01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.15 Linux/6.17.0-1022-azure
|
Release files / bigdata_corp_api-0.18.9-py3-none-any.whl
| Download URL | bigdata_corp_api-0.18.9-py3-none-any.whl |
|---|---|
| Size | 29.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b175c0f487aa24e066e9854057eb916126fa745672044c89cdf5cd6868e6eb60
|
|
BLAKE2b-256 checksum How to use checksums |
9121bd17abe90710673fbdd056de8828d6a73762900f669bd1d4f0c50fa22236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.15 Linux/6.17.0-1022-azure
|
Security for bigdata-corp-api 0.18.9
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.