[![Build Status](https://travis-ci.org/block-cat/sf-sdk.svg?branch=master)](https://travis-ci.org/block-cat/sf-sdk)
[![Coverage Status](https://coveralls.io/repos/github/block-cat/sf-sdk/badge.svg?branch=master)](https://coveralls.io/github/block-cat/sf-sdk?branch=master)
[![PYPI](https://img.shields.io/pypi/v/sf-sdk)](https://pypi.org/project/sf-sdk/)
# 顺丰 Python SDK
基于顺丰官网开放平台2.0 API开发的Python SDK
版本:2.0.0.2
## 功能概述
目前已经开发完成的接口列表:
* 下订单接口
* 订单确认/取消接口-速运类API
* 订单结果查询接口
* 路由查询接口接口-速运类API
* 订单筛选接口-速运类API
其他接口正在陆续对接中...
## 安装
```python
pip install sf-sdk
```
## 使用示例
clientcode和checkword是在顺丰官网注册后得到的用户编码和校验码
```python
from sf.api import SF
sf = SF("clientcode","checkword")
sf.order.create_order(clientid,..)
```
### 下单
```python
contacts = []
sender = ContactInfo("北京市昌平区回龙观天慧园",company="测试公司",mobile="18512345678")
receiver = ContactInfo("北京市海淀区新中关大厦A座",company="新东方",mobile="18511223344",contactType=1)
contacts.append(sender)
contacts.append(receiver)
cargo_detail = CargoDetail("测试货物")
res = self.sf.order.create_order(self.order_no, contacts,[cargo_detail])
```
### 订单查询
```python
res = self.sf.order.get_order(self.order_no)
```
### 确认/取消订单
```python
res = self.sf.order.confirm_order(self.order_no, dealType=2)
```
### 路由信息
```python
res = self.sf.order.get_route_info(self.order_no)
```
### 判断是否可以派单
```python
res = self.sf.order.can_delivery(self.order_no)
```
### 打印电子面单
```python
res = self.sf.order.get_order(self.order_no)
documents = [
{
"masterWaybillNo": res['msgData']['waybillNoInfoList'][0]['waybillNo'],
}
]
res = self.sf.sheet.sync_print(f"fm_150_standard_QXH",documents)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/block-cat/sf-sdk",
"name": "sf-sdk",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "sf sdk",
"author": "blackcat",
"author_email": "kfx2007@163.com",
"download_url": "https://files.pythonhosted.org/packages/55/22/1dc2abc99abf75e76637cff8a7c39a56dc83142af235f3a1e8245ea8cb76/sf-sdk-2.0.0.8.tar.gz",
"platform": null,
"description": "[![Build Status](https://travis-ci.org/block-cat/sf-sdk.svg?branch=master)](https://travis-ci.org/block-cat/sf-sdk)\n[![Coverage Status](https://coveralls.io/repos/github/block-cat/sf-sdk/badge.svg?branch=master)](https://coveralls.io/github/block-cat/sf-sdk?branch=master)\n[![PYPI](https://img.shields.io/pypi/v/sf-sdk)](https://pypi.org/project/sf-sdk/)\n\n# \u987a\u4e30 Python SDK\n\n\u57fa\u4e8e\u987a\u4e30\u5b98\u7f51\u5f00\u653e\u5e73\u53f02.0 API\u5f00\u53d1\u7684Python SDK\n\n\u7248\u672c\uff1a2.0.0.2\n\n## \u529f\u80fd\u6982\u8ff0\n\n\u76ee\u524d\u5df2\u7ecf\u5f00\u53d1\u5b8c\u6210\u7684\u63a5\u53e3\u5217\u8868:\n\n* \u4e0b\u8ba2\u5355\u63a5\u53e3\n* \u8ba2\u5355\u786e\u8ba4/\u53d6\u6d88\u63a5\u53e3-\u901f\u8fd0\u7c7bAPI\n* \u8ba2\u5355\u7ed3\u679c\u67e5\u8be2\u63a5\u53e3\n* \u8def\u7531\u67e5\u8be2\u63a5\u53e3\u63a5\u53e3-\u901f\u8fd0\u7c7bAPI\n* \u8ba2\u5355\u7b5b\u9009\u63a5\u53e3-\u901f\u8fd0\u7c7bAPI\n\n\u5176\u4ed6\u63a5\u53e3\u6b63\u5728\u9646\u7eed\u5bf9\u63a5\u4e2d...\n\n## \u5b89\u88c5\n\n```python\npip install sf-sdk\n```\n\n## \u4f7f\u7528\u793a\u4f8b\n\nclientcode\u548ccheckword\u662f\u5728\u987a\u4e30\u5b98\u7f51\u6ce8\u518c\u540e\u5f97\u5230\u7684\u7528\u6237\u7f16\u7801\u548c\u6821\u9a8c\u7801\n\n```python\nfrom sf.api import SF\n\nsf = SF(\"clientcode\",\"checkword\")\nsf.order.create_order(clientid,..)\n```\n\n### \u4e0b\u5355\n\n```python\ncontacts = []\nsender = ContactInfo(\"\u5317\u4eac\u5e02\u660c\u5e73\u533a\u56de\u9f99\u89c2\u5929\u6167\u56ed\",company=\"\u6d4b\u8bd5\u516c\u53f8\",mobile=\"18512345678\")\nreceiver = ContactInfo(\"\u5317\u4eac\u5e02\u6d77\u6dc0\u533a\u65b0\u4e2d\u5173\u5927\u53a6A\u5ea7\",company=\"\u65b0\u4e1c\u65b9\",mobile=\"18511223344\",contactType=1)\ncontacts.append(sender)\ncontacts.append(receiver)\ncargo_detail = CargoDetail(\"\u6d4b\u8bd5\u8d27\u7269\")\nres = self.sf.order.create_order(self.order_no, contacts,[cargo_detail])\n```\n\n### \u8ba2\u5355\u67e5\u8be2\n\n```python\nres = self.sf.order.get_order(self.order_no)\n```\n\n### \u786e\u8ba4/\u53d6\u6d88\u8ba2\u5355\n\n```python\nres = self.sf.order.confirm_order(self.order_no, dealType=2)\n```\n\n### \u8def\u7531\u4fe1\u606f\n\n```python\nres = self.sf.order.get_route_info(self.order_no)\n```\n\n### \u5224\u65ad\u662f\u5426\u53ef\u4ee5\u6d3e\u5355\n\n```python\nres = self.sf.order.can_delivery(self.order_no)\n```\n\n### \u6253\u5370\u7535\u5b50\u9762\u5355\n\n```python\nres = self.sf.order.get_order(self.order_no)\ndocuments = [\n {\n \"masterWaybillNo\": res['msgData']['waybillNoInfoList'][0]['waybillNo'],\n }\n]\nres = self.sf.sheet.sync_print(f\"fm_150_standard_QXH\",documents)\n```\n\n",
"bugtrack_url": null,
"license": "GNU",
"summary": "Shunfeng Express Python SDK",
"version": "2.0.0.8",
"project_urls": {
"Homepage": "https://github.com/block-cat/sf-sdk"
},
"split_keywords": [
"sf",
"sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "55221dc2abc99abf75e76637cff8a7c39a56dc83142af235f3a1e8245ea8cb76",
"md5": "037fe3521feb66c3d37bc6486f70f996",
"sha256": "5de6ce01116224dd89ad400db6677ce77bcceb7672b98eec1135a6a848713334"
},
"downloads": -1,
"filename": "sf-sdk-2.0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "037fe3521feb66c3d37bc6486f70f996",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15484,
"upload_time": "2023-08-29T02:35:44",
"upload_time_iso_8601": "2023-08-29T02:35:44.469616Z",
"url": "https://files.pythonhosted.org/packages/55/22/1dc2abc99abf75e76637cff8a7c39a56dc83142af235f3a1e8245ea8cb76/sf-sdk-2.0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-29 02:35:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "block-cat",
"github_project": "sf-sdk",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"requirements": [],
"lcname": "sf-sdk"
}