All Projects → mstuttgart → Pycep Correios

mstuttgart / Pycep Correios

Licence: mit
📦 API para busca de CEP integrado ao serviços dos Correios, ViaCEP e ApiCEP (WideNet)

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Pycep Correios

Strapi Plugin Comments
A plugin for Strapi Headless CMS that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and more.
Stars: ✭ 138 (-2.13%)
Mutual labels:  api
Cityengine Sdk
CityEngine is a 3D city modeling software for urban design, visual effects, and VR/AR production. With its C++ SDK you can create plugins and standalone apps capable to execute CityEngine CGA procedural modeling rules.
Stars: ✭ 137 (-2.84%)
Mutual labels:  api
Unit Api
Units of Measurement API
Stars: ✭ 140 (-0.71%)
Mutual labels:  api
Tastyworks api
An unofficial, reverse-engineered Python API for tastyworks.
Stars: ✭ 138 (-2.13%)
Mutual labels:  api
Postman Bdd
A BDD test framework for Postman and Newman
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Apisix Ingress Controller
ingress controller for K8s
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Poloniex Api Node
Poloniex API client for REST and WebSocket API
Stars: ✭ 138 (-2.13%)
Mutual labels:  api
Js Libs
A collection of JavaScript libraries for Ethereum dapp development.
Stars: ✭ 141 (+0%)
Mutual labels:  api
Telegram Bot Api
Telegram Bot API PHP
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Archiveis
A simple Python wrapper for the archive.is capturing service
Stars: ✭ 140 (-0.71%)
Mutual labels:  api
Pithy Test
简化接口测试
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Conari
🧬 Platform for unmanaged memory, pe-modules, related PInvoke features, and more for: Libraries, Executable Modules, enjoy using of the unmanaged native C/C++ in .NET world, and other raw binary data …
Stars: ✭ 138 (-2.13%)
Mutual labels:  api
Migrationminer
A tool to detect migration code between two Java third-party libraries
Stars: ✭ 140 (-0.71%)
Mutual labels:  api
Flutter Tiktok Ui Api Clone
Flutter Tiktok UI API Clone
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Pytodoist
Use Todoist with Python ✅
Stars: ✭ 140 (-0.71%)
Mutual labels:  api
Pure Http
✨ The simple web framework for Node.js with zero dependencies.
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Librouteros
Python implementation of MikroTik RouterOS API
Stars: ✭ 139 (-1.42%)
Mutual labels:  api
Api Query Params
Convert URL query parameters to MongoDB queries
Stars: ✭ 141 (+0%)
Mutual labels:  api
Rivus cep
Complex event processing in Erlang
Stars: ✭ 140 (-0.71%)
Mutual labels:  cep
Awesome Documentation Tools
🔥 📚 All the tools, processes and resources you need to create an awesome API & Project documentation
Stars: ✭ 138 (-2.13%)
Mutual labels:  api



PyCEPCorreios

Version Coveralls github Code Climate maintainability Ratings Version

API para busca de CEP integrado ao serviços dos Correios, ViaCEP e ApiCEP (WideNet)

Instalação | Como Usar | Como Contribuir | Créditos

Instalação

A PyCEPCorreios pode ser facilmente instalada com o comando a seguir:

pip install pycep-correios

Atualmente, a PyCEPCorreios possui suporte para Python 3.5+.

Como usar

A PyCEPCorreios foi desenvolvida para integração de consultas sob demandas em páginas web. A consulta de CEPs em massa através de scripts ou qualquer outros meios não é recomendada.

A PyCEPCorreios utiliza por padrão de consulta a API provida pelo serviço ApiCEP. Para utilização de outros serviços, devemos indica o serviço desejado ao chamar a função get_address_from_cep. O CEP sempre deve ser uma string e pode ou não conter pontuação.

Exemplo de consulta ao serviço ApiCEP (default):

from pycep_correios import get_address_from_cep, WebService

address = get_address_from_cep('37503-130', webservice=WebService.APICEP)

Exemplo de consulta ao serviço ViaCEP:

from pycep_correios import get_address_from_cep, WebService

address = get_address_from_cep('37503-130', webservice=WebService.VIACEP)

Exemplo de consulta ao serviço dos Correios:

from pycep_correios import get_address_from_cep, WebService

address = get_address_from_cep('37503-130', webservice=WebService.CORREIOS)

Obs.: O serviço de busca de CEP dos Correios é parte integrante do serviço SIGEPWeb e para uso do mesmo é necessário ter contrato com os Correios, conforme indicado no capítulo Introdução presente no manual de integração do serviço.

Retorno e Exceptions

Independente do serviço escolhido, o formato de resposta sempre será um objeto dict contendo as seguintes chaves:

{
    'bairro': 'str',
    'cep': 'str',
    'cidade': 'str',
    'logradouro': 'str',
    'uf': 'str',
    'complemento': 'str',
}

A PyCEPCorreios tambem dá suporte a um grupo de exceptions que podem ser utilizadas para tratamento de quaisquer erros que ocorram durante o processo de consulta.

from pycep_correios import get_address_from_cep, WebService, exceptions

try:

    address = get_address_from_cep('37503-130', webservice=WebService.APICEP)

except exceptions.InvalidCEP as eic:
    print(eic)

except exceptions.CEPNotFound as ecnf:
    print(ecnf)

except exceptions.ConnectionError as errc:
    print(errc)

except exceptions.Timeout as errt:
    print(errt)

except exceptions.HTTPError as errh:
    print(errh)

except exceptions.BaseException as e:
    print(e)

Como contribuir

Deseja participar do desenvolvimento da PyCEPCorreios? Veja a guideline de contribuição aqui.

Créditos

Copyright (C) 2016-2021 por Michell Stuttgart

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].