
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data
About | Install | Quick Start | Documentation | Contribute | Credits
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.
To install the latest stable release of BrazilCEP, use pip:
pip install brazilcep
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.
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.
Comprehensive documentation for BrazilCEP is available on ReadTheDocs.
To contribute, follow the guidelines outlined here.
Copyright (C) 2016-2024 by Michell Stuttgart
FAQs
Minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data
We found that brazilcep demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.