Skip to main content
Warning Some features may not work without JavaScript. Please try enabling it if you encounter problems.

Minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data

Project description

BrazilCEP Logo
BrazilCEP

GitHub Workflow Status Codecov Read the Docs Downloads PyPI Version Python Versions

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brazilcep-7.0.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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.

brazilcep-7.0.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

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

Hashes for brazilcep-7.0.1.tar.gz
Algorithm Hash digest
SHA256 1797dbc462be48a5bcb95853a735d6a4450e172ece3a3dedb2972c656b71dc98
MD5 d9963ac01e9bdf50021e6c4759e36c9e
BLAKE2b-256 417f59c96238ef36418166975c51a471577cfb6a644d0eebe1b74998e80b1a4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for brazilcep-7.0.1.tar.gz:

Publisher: release.yml on mstuttgart/brazilcep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for brazilcep-7.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74391e3ea8d4011c6dc2f1b97dc401fd727405e789fcce6558057257f1858a3a
MD5 453d13f1f4c07c5c8e1a9f1535745316
BLAKE2b-256 310bf75f8d8d8e8d287e492398d7488052fe1eee775fd9086e0a3f2663003371

See more details on using hashes here.

Provenance

The following attestation bundles were made for brazilcep-7.0.1-py3-none-any.whl:

Publisher: release.yml on mstuttgart/brazilcep

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.