sellsy_api是sellsy api的一个小客户
sellsy-api的Python项目详细描述
sellsy api
>;使用python管理sellsy平台的小型客户端
sellsy api是官方[sellsy api]的客户端(https://api.sellsy.com),允许您从[sellsy平台](https://welcome.sellsy.com/)获取和操作数据。官方客户端是用php编写的,这是一个用纯python编写的客户端。
*一个python包管理器([pip](https://pip.pypa.io/en/stable/installing/),[pipenv](http://pipenv.readthedocs.io/en/latest/),[conda](https://conda.io/docs/),
``shell
$cd/path/to/my/project
$pipenv install sellsy-u-sallsy-api
````
>现在验证一下成功安装的软件包是否已经成功安装
```shell
$python
>;import sellsy-u-api不应该引发异常
````
\快速入门
```python
import os
import sellsy-api
“我的用户秘密”,“我的用户秘密”,尝试:
infos=client.api(method='infos.getinfos')
prospect=client.api(method='prospects.getone',params={'id':55})
除了sellsy api之外,sellsyauthenticateerror as e:;如果凭据密钥无效,则引发失败!详细信息:{}.format(e))
sellsy api.sellsy error as e:“;如果sellsy api返回错误(
print(e)
prospect_name=prospect['corporation']['name']
`````
您可以使用“client.api(method='',params={})”访问完整的sellsy api[方法](https://api.sellsy.com/documentation/methods)。
函数返回一个包含响应的字典:
``json
{
“corporation”:{
“id”:“55”,
“corpid”:“644”,
“name”:“new prospect”,
“…”,
“created”:“2013-01-31 14:49:35”,
“updated”:“2013-01-31 16:41:38”
“contacts”:[
{
“id”:“44”,
“prospectid”:“55”,
“…”,
“sign”:“,
“birthdate”:“0000-00-00”
}
]
}
`````
>目前,通过调用函数可以引发两个异常:
-`sellsyauthenticateerror`:如果“consumer-key”、`consumer-secret`,` user_token或user_secret无效,或者如果身份验证失败
-`sellsy error`:sellsy api可能返回错误,例如取决于无效的非常量ressource或方法。因此,会引发此异常,您可以访问异常信息以获得更多详细信息或错误:`{code}-{detail}`其中,如果[此处]描述了某个代码错误(https://api.sellsy.com/documentation/errors)(在错误处理选项卡中)。
-\u即将出现:通过不同的异常捕获精确错误的更多异常(示例:SellsyRessourceNotFound,如果你要求的源不存在),而不仅仅是通过一个独特的“SellsyError”与不同的消息…
>
-[sellsy平台](https://www.sellsy.com/)
-[sellsy-api](https://api.sellsy.com)
-[sellsy-api问题跟踪器](https://github.com/annouar/sellsy客户端/问题)
>
-**mit:http://opensource.org/licenses/licenses/mit
>
>
是的