跳转到主要内容

Python中Correios的API

项目描述

API Correios
============

安装
------------
如果您有 _setuptools_,可以使用

$ easy_install -U pycorreios

否则,您可以从[GitHub][git]下载源代码并运行

$ python setup.py install

[git]: https://github.com/avelino/pycorreios "PyCorreios"

示例
--------
pyCorreios代码的一些简单示例

```python
from pycorreios import Correios

# 使用字典参数 - 字段顺序无关紧要
fields = {"cod": Correios().SEDEX,
"GOCEP": "44001535",
"HERECEP": "03971010",
"peso": "2",
"formato": "1", # 箱子/包裹
"comprimento": "18",
"altura": "8",
"largura": "24",
"diametro": "12"}

test = Correios().frete(**fields) # 记得用**调用

# 或者使用位置参数 - 与上面相同的结果
test = Correios().frete(Correios().SEDEX,'44001535','03971010',2,1,18,8,24,12)

if test['Erro'] != '0'
print '发生错误! :('
print test['Erro']
print test['MsgErro']
else
print "价值: R$%s\n交付期限:%s" % (test['Valor'],test['PrazoEntrega'])


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

项目详情


下载文件

下载适合您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源代码分发

pycorreios-0.1.2.tar.gz (5.3 kB 查看哈希值)

上传时间 源代码

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面