Minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data
Project description
BrazilCEP
About | Install | Quick Start | Documentation | Contribute | Credits
About
BrazilCEP is a minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data.
Its goal is to provide a unified query interface for multiple search services, simplifying the integration of Python applications with these services.
Currently, it supports several CEP APIs:
[!NOTE] BrazilCEP is the new name of the former PyCEPCorreio Python library. To migrate your old code to the new version, refer to the migration guide.
[!TIP] CEP or Código de Endereçamento Postal (Postal Address Code) is a system of numeric codes created, maintained, and organized by Correios do Brasil to streamline address organization and delivery of letters and parcels.
Install
To install the latest stable release of BrazilCEP, use pip:
pip install brazilcep
Quick Start
Making a request is straightforward. Start by importing the BrazilCEP module:
>>> import brazilcep
Next, use the get_address_from_cep function to query any CEP:
>>> address = brazilcep.get_address_from_cep('37503-130')
The result is a dictionary containing the address details:
>>> address
{
'district': 'rua abc',
'cep': '37503130',
'city': 'city ABC',
'street': 'str',
'uf': 'str',
'complement': 'str',
}
The CEP must always be provided as a string.
[!TIP] BrazilCEP is designed for on-demand queries in web applications. Bulk querying through scripts or other means is discouraged.
[!IMPORTANT] BrazilCEP does not guarantee the availability or support of any third-party query APIs. This library serves as a convenient interface for accessing these services.
Asynchronous Requests with BrazilCEP
BrazilCEP (version >= 7.0.0) also supports asynchronous operations , allowing you to retrieve address information for a given CEP without blocking your application. This is particularly useful for web applications or services that require high responsiveness.
To perform an asynchronous request, use the async_get_address_from_cep function:
import asyncio
import brazilcep
async def main():
address = await brazilcep.async_get_address_from_cep('37503-130')
print(address)
asyncio.run(main())
[!NOTE] This function is asynchronous and must be awaited when called. Ensure that your environment supports asynchronous programming before using this function.
Documentation
Comprehensive documentation for BrazilCEP is available on ReadTheDocs.
Contribute
To contribute, follow the guidelines outlined here.
Credits
Copyright (C) 2016-2024 by Michell Stuttgart
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
The dropdown lists show the available interpreters, ABIs, and platforms.
Enable javascript to be able to filter the list of wheel files.
Copy a direct link to the current filters
File details
Details for the file brazilcep-7.0.1.tar.gz.
File metadata
- Download URL: brazilcep-7.0.1.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1797dbc462be48a5bcb95853a735d6a4450e172ece3a3dedb2972c656b71dc98
|
|
| MD5 |
d9963ac01e9bdf50021e6c4759e36c9e
|
|
| BLAKE2b-256 |
417f59c96238ef36418166975c51a471577cfb6a644d0eebe1b74998e80b1a4d
|
Provenance
The following attestation bundles were made for brazilcep-7.0.1.tar.gz:
Publisher:
release.yml on mstuttgart/brazilcep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brazilcep-7.0.1.tar.gz -
Subject digest:
1797dbc462be48a5bcb95853a735d6a4450e172ece3a3dedb2972c656b71dc98 - Sigstore transparency entry: 402140971
- Sigstore integration time:
-
Permalink:
mstuttgart/brazilcep@42e413b483c98dc3904b4900105f781d18278b45 -
Branch / Tag:
refs/tags/7.0.1 - Owner: https://github.com/mstuttgart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@42e413b483c98dc3904b4900105f781d18278b45 -
Trigger Event:
push
-
Statement type:
File details
Details for the file brazilcep-7.0.1-py3-none-any.whl.
File metadata
- Download URL: brazilcep-7.0.1-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74391e3ea8d4011c6dc2f1b97dc401fd727405e789fcce6558057257f1858a3a
|
|
| MD5 |
453d13f1f4c07c5c8e1a9f1535745316
|
|
| BLAKE2b-256 |
310bf75f8d8d8e8d287e492398d7488052fe1eee775fd9086e0a3f2663003371
|
Provenance
The following attestation bundles were made for brazilcep-7.0.1-py3-none-any.whl:
Publisher:
release.yml on mstuttgart/brazilcep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brazilcep-7.0.1-py3-none-any.whl -
Subject digest:
74391e3ea8d4011c6dc2f1b97dc401fd727405e789fcce6558057257f1858a3a - Sigstore transparency entry: 402140992
- Sigstore integration time:
-
Permalink:
mstuttgart/brazilcep@42e413b483c98dc3904b4900105f781d18278b45 -
Branch / Tag:
refs/tags/7.0.1 - Owner: https://github.com/mstuttgart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@42e413b483c98dc3904b4900105f781d18278b45 -
Trigger Event:
push
-
Statement type: