Skip to main content

brzipcode is a lightweight app for retrieving brazilian addresses from a zip code

Project description

brzipcode é uma lib Python simples para retornar o endereço a partir do CEP, com dados provenientes do webservice brzipcode.com.

Para instalar execute:

pip install brzipcode

E então usar conforme abaixo:

>>> from brzipcode import BRZipCode
>>> print BRZipCode.get('04538132', token='ycmVyGJO3HAw...') # *
{u'status': True, u'city': u'S\xe3o Paulo', u'state': u'SP', u'neighborhood': u'Itaim Bibi', u'address': u'Avenida Brigadeiro Faria Lima - de 3252 ao fim - lado par'}

** Para solicitar um token acesse http://brzipcode.com/ (gratuito) **

Caso não encontre nenhum resultado:

>>> print BRZipCode.get('00000000', token='ycmVyGJO3HAw...')
{u'status': False, u'error_message': u'not_found'}

Suporte a projetos Django

Para utilizar em seu projeto Django, inclua BRZIPCODE_TOKEN e atualize o INSTALLED_APPS no arquivo settings.py

BRZIPCODE_TOKEN = 'ycmVyGJO3HAw...'

...

INSTALLED_APPS = (
    ...
    'brzipcode',
)

Adicionar a url do serviço no urls.py

urlpatterns = patterns('',
    ...
    url(r'^brzipcode/', include('brzipcode.urls')),
)

E acesse:

http://localhost:8000/brzipcode/?zip_code=04538132

Project details


Release history Release notifications

This version
History Node

0.1.2

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
brzipcode-0.1.2.tar.gz (2.9 kB) Copy SHA256 hash SHA256 Source None May 25, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page