bigdata-corp-api 0.16__tar.gz → 0.18.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bigdata_corp_api-0.18.3/PKG-INFO +157 -0
- bigdata_corp_api-0.18.3/README.md +141 -0
- {bigdata_corp_api-0.16 → bigdata_corp_api-0.18.3}/pyproject.toml +5 -6
- bigdata_corp_api-0.18.3/src/bigdatacorp_api/__init__.py +13 -0
- bigdata_corp_api-0.18.3/src/bigdatacorp_api/data.py +807 -0
- bigdata_corp_api-0.18.3/src/bigdatacorp_api/exceptions.py +95 -0
- bigdata_corp_api-0.16/PKG-INFO +0 -17
- bigdata_corp_api-0.16/README.md +0 -2
- bigdata_corp_api-0.16/src/bigdatacorp_api/__init__.py +0 -0
- bigdata_corp_api-0.16/src/bigdatacorp_api/data.py +0 -734
- bigdata_corp_api-0.16/src/bigdatacorp_api/exceptions.py +0 -66
- {bigdata_corp_api-0.16 → bigdata_corp_api-0.18.3}/LICENSE +0 -0
- {bigdata_corp_api-0.16 → bigdata_corp_api-0.18.3}/src/bigdatacorp_api/tests/test__bigdata_api.py +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bigdata-corp-api
|
|
3
|
+
Version: 0.18.3
|
|
4
|
+
Summary: Python API to facilitate interaction with BigDataCorp end-points
|
|
5
|
+
License: BSD-3-Clause License
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Murabei Data Science
|
|
8
|
+
Author-email: a.baceti@murabei.com
|
|
9
|
+
Requires-Python: >=3.6
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Dist: requests
|
|
13
|
+
Project-URL: Homepage, https://github.com/Murabei-OpenSource-Codes/bigdata-corp-api
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# bigdata-corp-api
|
|
17
|
+
|
|
18
|
+
Python client library for BigDataCorp API endpoints used in Murabei data
|
|
19
|
+
enrichment and due-diligence workflows.
|
|
20
|
+
|
|
21
|
+
## Objective and motivation
|
|
22
|
+
|
|
23
|
+
This package wraps BigDataCorp REST endpoints behind a typed Python API with
|
|
24
|
+
domain-specific exceptions and dataset discovery helpers.
|
|
25
|
+
|
|
26
|
+
### Why this exists
|
|
27
|
+
|
|
28
|
+
Murabei services query BigDataCorp for CPF, CNPJ, and process data during
|
|
29
|
+
enrichment pipelines. A shared client avoids duplicating authentication,
|
|
30
|
+
retry logic, and error mapping across workers and applications.
|
|
31
|
+
|
|
32
|
+
### How it is used
|
|
33
|
+
|
|
34
|
+
Install the package in workers or apps that call BigDataCorp during batch or
|
|
35
|
+
on-demand enrichment. Instantiate `BigDataCorpAPI` with an auth token, then
|
|
36
|
+
call dataset list or fetch methods.
|
|
37
|
+
|
|
38
|
+
### Scope
|
|
39
|
+
|
|
40
|
+
Owns HTTP communication, dataset constants, exception types, usage
|
|
41
|
+
reporting, and certificate file downloads from on-demand responses.
|
|
42
|
+
Credential storage, orchestration, and downstream persistence live in
|
|
43
|
+
consuming services.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
From PyPI (when published):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install bigdata-corp-api
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
From a built wheel or sdist:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install dist/bigdata_corp_api-*.whl
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
From source (requires Poetry):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install poetry
|
|
63
|
+
export VERSION=$(grep -E '^VERSION=' VERSION | cut -d'=' -f2-)
|
|
64
|
+
sed -e 's#{VERSION}#'"${VERSION}"'#g' pyproject_template.toml > pyproject.toml
|
|
65
|
+
poetry build
|
|
66
|
+
pip install dist/bigdata_corp_api-*.whl
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from bigdatacorp_api.data import BigDataCorpAPI
|
|
73
|
+
|
|
74
|
+
api = BigDataCorpAPI(bigdata_auth_token="YOUR_TOKEN")
|
|
75
|
+
|
|
76
|
+
# List available CPF datasets
|
|
77
|
+
datasets = api.list_cpf_dataset()
|
|
78
|
+
|
|
79
|
+
# Fetch one dataset
|
|
80
|
+
result = api.get_cpf_dataset(
|
|
81
|
+
cpf="12345678901",
|
|
82
|
+
dataset="basic_data",
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Fetch multiple datasets
|
|
86
|
+
batch = api.get_cpf_datasets(
|
|
87
|
+
cpf="12345678901",
|
|
88
|
+
datasets=["basic_data", "occupation_data"],
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
CNPJ and process queries follow the same pattern via `list_cnpj_dataset`,
|
|
93
|
+
`get_cnpj_dataset`, `list_process_dataset`, and `get_process_dataset`.
|
|
94
|
+
|
|
95
|
+
Usage reporting for a date range:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
usage = api.get_usage(
|
|
99
|
+
initial_date="2025-01-01",
|
|
100
|
+
final_date="2025-01-31",
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Download a certificate file from an on-demand dataset response:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
cert_response = api.get_cpf_dataset(
|
|
108
|
+
cpf="12345678901",
|
|
109
|
+
dataset="ondemand_cert_debt_absence_by_state_person",
|
|
110
|
+
)
|
|
111
|
+
file_data = api.get_result_file(
|
|
112
|
+
dataset="ondemand_cert_debt_absence_by_state_person",
|
|
113
|
+
json_data=cert_response,
|
|
114
|
+
)
|
|
115
|
+
# file_data["file_type"] and file_data["file_content"]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
| Variable | Required | Description |
|
|
121
|
+
|----------|----------|-------------|
|
|
122
|
+
| `BIGDATA_AUTH_TOKEN` | Yes (for tests) | BigDataCorp API token passed to `BigDataCorpAPI` |
|
|
123
|
+
| `TEST_CPF` | Tests only | Valid CPF used by integration tests |
|
|
124
|
+
|
|
125
|
+
The token is supplied at construction time; this package does not read
|
|
126
|
+
environment variables during normal API calls.
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
Build a release (bumps patch in `VERSION`, renders `pyproject.toml`, tags,
|
|
131
|
+
and pushes):
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
./build.sh
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Run tests (integration tests call the live API when env vars are set):
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
export BIGDATA_AUTH_TOKEN="your-token"
|
|
141
|
+
export TEST_CPF="valid-cpf"
|
|
142
|
+
python -m unittest discover -s src/bigdatacorp_api/tests
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Lint with Ruff (configuration in `pyproject.toml`):
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
ruff check src/
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
CI on `main` builds from `VERSION` and `pyproject_template.toml`, then
|
|
152
|
+
publishes to PyPI when `PYPI_API_TOKEN` is configured.
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
BSD-3-Clause — see [LICENSE](LICENSE).
|
|
157
|
+
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# bigdata-corp-api
|
|
2
|
+
|
|
3
|
+
Python client library for BigDataCorp API endpoints used in Murabei data
|
|
4
|
+
enrichment and due-diligence workflows.
|
|
5
|
+
|
|
6
|
+
## Objective and motivation
|
|
7
|
+
|
|
8
|
+
This package wraps BigDataCorp REST endpoints behind a typed Python API with
|
|
9
|
+
domain-specific exceptions and dataset discovery helpers.
|
|
10
|
+
|
|
11
|
+
### Why this exists
|
|
12
|
+
|
|
13
|
+
Murabei services query BigDataCorp for CPF, CNPJ, and process data during
|
|
14
|
+
enrichment pipelines. A shared client avoids duplicating authentication,
|
|
15
|
+
retry logic, and error mapping across workers and applications.
|
|
16
|
+
|
|
17
|
+
### How it is used
|
|
18
|
+
|
|
19
|
+
Install the package in workers or apps that call BigDataCorp during batch or
|
|
20
|
+
on-demand enrichment. Instantiate `BigDataCorpAPI` with an auth token, then
|
|
21
|
+
call dataset list or fetch methods.
|
|
22
|
+
|
|
23
|
+
### Scope
|
|
24
|
+
|
|
25
|
+
Owns HTTP communication, dataset constants, exception types, usage
|
|
26
|
+
reporting, and certificate file downloads from on-demand responses.
|
|
27
|
+
Credential storage, orchestration, and downstream persistence live in
|
|
28
|
+
consuming services.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
From PyPI (when published):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install bigdata-corp-api
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
From a built wheel or sdist:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install dist/bigdata_corp_api-*.whl
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
From source (requires Poetry):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install poetry
|
|
48
|
+
export VERSION=$(grep -E '^VERSION=' VERSION | cut -d'=' -f2-)
|
|
49
|
+
sed -e 's#{VERSION}#'"${VERSION}"'#g' pyproject_template.toml > pyproject.toml
|
|
50
|
+
poetry build
|
|
51
|
+
pip install dist/bigdata_corp_api-*.whl
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick start
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from bigdatacorp_api.data import BigDataCorpAPI
|
|
58
|
+
|
|
59
|
+
api = BigDataCorpAPI(bigdata_auth_token="YOUR_TOKEN")
|
|
60
|
+
|
|
61
|
+
# List available CPF datasets
|
|
62
|
+
datasets = api.list_cpf_dataset()
|
|
63
|
+
|
|
64
|
+
# Fetch one dataset
|
|
65
|
+
result = api.get_cpf_dataset(
|
|
66
|
+
cpf="12345678901",
|
|
67
|
+
dataset="basic_data",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Fetch multiple datasets
|
|
71
|
+
batch = api.get_cpf_datasets(
|
|
72
|
+
cpf="12345678901",
|
|
73
|
+
datasets=["basic_data", "occupation_data"],
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
CNPJ and process queries follow the same pattern via `list_cnpj_dataset`,
|
|
78
|
+
`get_cnpj_dataset`, `list_process_dataset`, and `get_process_dataset`.
|
|
79
|
+
|
|
80
|
+
Usage reporting for a date range:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
usage = api.get_usage(
|
|
84
|
+
initial_date="2025-01-01",
|
|
85
|
+
final_date="2025-01-31",
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Download a certificate file from an on-demand dataset response:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
cert_response = api.get_cpf_dataset(
|
|
93
|
+
cpf="12345678901",
|
|
94
|
+
dataset="ondemand_cert_debt_absence_by_state_person",
|
|
95
|
+
)
|
|
96
|
+
file_data = api.get_result_file(
|
|
97
|
+
dataset="ondemand_cert_debt_absence_by_state_person",
|
|
98
|
+
json_data=cert_response,
|
|
99
|
+
)
|
|
100
|
+
# file_data["file_type"] and file_data["file_content"]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Configuration
|
|
104
|
+
|
|
105
|
+
| Variable | Required | Description |
|
|
106
|
+
|----------|----------|-------------|
|
|
107
|
+
| `BIGDATA_AUTH_TOKEN` | Yes (for tests) | BigDataCorp API token passed to `BigDataCorpAPI` |
|
|
108
|
+
| `TEST_CPF` | Tests only | Valid CPF used by integration tests |
|
|
109
|
+
|
|
110
|
+
The token is supplied at construction time; this package does not read
|
|
111
|
+
environment variables during normal API calls.
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
Build a release (bumps patch in `VERSION`, renders `pyproject.toml`, tags,
|
|
116
|
+
and pushes):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
./build.sh
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Run tests (integration tests call the live API when env vars are set):
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
export BIGDATA_AUTH_TOKEN="your-token"
|
|
126
|
+
export TEST_CPF="valid-cpf"
|
|
127
|
+
python -m unittest discover -s src/bigdatacorp_api/tests
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Lint with Ruff (configuration in `pyproject.toml`):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
ruff check src/
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
CI on `main` builds from `VERSION` and `pyproject_template.toml`, then
|
|
137
|
+
publishes to PyPI when `PYPI_API_TOKEN` is configured.
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
BSD-3-Clause — see [LICENSE](LICENSE).
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "bigdata-corp-api"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.18.3"
|
|
4
4
|
description = "Python API to facilitate interaction with BigDataCorp end-points"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.6"
|
|
7
7
|
license = { text = "BSD-3-Clause License" }
|
|
8
8
|
authors = [
|
|
9
|
-
{name = "
|
|
9
|
+
{name = "Murabei Data Science", email = "a.baceti@murabei.com"}
|
|
10
10
|
]
|
|
11
|
+
urls = { Homepage = "https://github.com/Murabei-OpenSource-Codes/bigdata-corp-api" }
|
|
11
12
|
classifiers = [
|
|
12
13
|
"Programming Language :: Python :: 3",
|
|
13
14
|
"Operating System :: OS Independent",
|
|
14
15
|
]
|
|
15
16
|
dependencies = [
|
|
16
|
-
"requests"
|
|
17
|
+
"requests",
|
|
17
18
|
]
|
|
18
19
|
|
|
19
20
|
[tool.poetry]
|
|
@@ -31,8 +32,6 @@ indent-width = 4
|
|
|
31
32
|
exclude = [
|
|
32
33
|
"secrets/",
|
|
33
34
|
"__init__.py",
|
|
34
|
-
"setup_template.py",
|
|
35
|
-
"setup.py"
|
|
36
35
|
]
|
|
37
36
|
|
|
38
37
|
# Lista de linters que serão aplicados. o ruff da suporte a vários e eles podem ser adicionados aqui.
|
|
@@ -69,4 +68,4 @@ no-sections = true
|
|
|
69
68
|
[dependency-groups]
|
|
70
69
|
docs = [
|
|
71
70
|
"mkdocs (>=1.6.1,<2.0.0)"
|
|
72
|
-
]
|
|
71
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""BigDataCorp API client package.
|
|
2
|
+
|
|
3
|
+
Provides ``BigDataCorpAPI`` for querying CPF, CNPJ, and process datasets,
|
|
4
|
+
plus domain-specific exceptions for API error handling.
|
|
5
|
+
|
|
6
|
+
Example:
|
|
7
|
+
Import the client from the ``data`` submodule::
|
|
8
|
+
|
|
9
|
+
from bigdatacorp_api.data import BigDataCorpAPI
|
|
10
|
+
|
|
11
|
+
api = BigDataCorpAPI(bigdata_auth_token="YOUR_TOKEN")
|
|
12
|
+
result = api.get_cpf_dataset(cpf="12345678901", dataset="basic_data")
|
|
13
|
+
"""
|