Python client for the Solldex API
Project description
SolldexAPI Python Client
This repository contains a Python client for interacting with the Solldex API. The client supports making requests to the following endpoints:
- Recepcionar Lote RPS
- Consultar Lote
- Consultar RPS
Features
- Simple and intuitive interface for making requests to the Solldex API.
- Built-in retry logic using the Tenacity library, with up to 3 retry attempts and a 2 second wait between each attempt.
- Error logging for better debugging and maintenance.
Installation
You can install the SolldexAPI Python Client via pip:
pip install solldex-api-client==0.1.0
Usage
To use the SolldexAPI client, you'll need to import the SolldexAPI class and initialize it with your API token:
from solldex_api import SolldexAPI
api = SolldexAPI('your-token-here')
Once you've done that, you can make requests to the Solldex API using the recepcionar_lote
, consultar_lote
, and consultar_rps
methods:
# Make a request to the Recepcionar Lote RPS endpoint
response = api.recepcionar_lote({
'data_emissao': 'date',
'prestador': {
'cnpj': 'string',
'inscricao_municipal': 'number',
'codigo_municipio': 'number'
},
# Additional data...
})
# Make a request to the Consultar Lote endpoint
response = api.consultar_lote({
'protocolo': 'number',
'cnpj': 'number',
'inscricao_municipal': 'number',
'codigo_municipio': 'number'
})
# Make a request to the Consultar RPS endpoint
response = api.consultar_rps({
'numero': 'number',
'serie': 'number',
'tipo': 'number',
'cnpj': 'number',
'inscricao_municipal': 'number',
'codigo_municipio': 'number'
})
Error Handling
The SolldexAPI client uses the Tenacity library to provide built-in retry logic for requests. If a request fails, the client will automatically retry it up to 3 times, with a 2 second wait between each attempt.
If a request continues to fail after 3 attempts, the client will log the error and raise a requests.RequestException
exception.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for solldex_api_client-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1745c9a1e41bc2351a0f9707aaa10458885327e08f881d59e6e61fc76167386 |
|
MD5 | 647128cb6bebea28ad7368536e0217fb |
|
BLAKE2b-256 | 6efc3474769e20992f7daf7ce78cd8530ec271a28c10c48336825fa4053ef78e |