Skip to content

dilannery/pycorreios

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Correios

Installation

If you have setuptools you can use $ easy_install -U pycorreios Otherwise, you can download the source from GitHub and run $ python setup.py install

Examples

Some simple examples of what pyCorreios code looks like: # -- coding: utf-8 -- from pycorreios import Correios

frete = Correios().frete(Correios().SEDEX,'44001535','03971010',10,18,8)
if frete['Erro'] != '0':
    print 'Deu erro! :('
    print frete['Erro']
    print frete['MsgErro']
else:
    print "Valor: R$%s\nPrazo de Entrega: %s" % (frete['Valor'],frete['PrazoEntrega'])

print

cep = Correios().cep('03971010')
for tag_name in cep.keys():
    print tag_name + ': ' + cep[tag_name]

encomenda = Correios().encomenda('SW238151411BR')
for status in encomenda:
    print 'Data: ' + status.data
    print 'Local: ' + status.local
    print 'Status: ' + status.status
    try:
        print 'Descricao: ' + status.descricao
    except:
        pass
    print '----------------------'

About

API Correios

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%