pyallegro是一个框架,它提供了一种使用allegro web api和rest ap的简单方法。
pyAllegro的Python项目详细描述
快板API
pyallegro是一个框架,它提供了使用allegroWeb API和Rest AP的简单方法。您不需要知道restful、soap或oauth 2.0是如何工作的。
至于现在,它准备从Allegro获取数据-而不是管理您的帐户或出价。
开始:
- 转到https://apps.developer.allegro.pl/并注册您的应用程序。您需要将redirecion url设置为
http://localhost:8000
-将是本地服务器接收您的自动调整数据(oauth 2.0), - 生成应用程序密码here,
- 用
pip install pyAllegro
安装pyallegro
- 导入
from pyAllegro.api import AllegroRestApi, AllegroWebApi
- 从Allegro收到的安装凭据(默认保存在此处:'/user s/{user}/.allegroapiconfig'):
WebApi = AllegroWebApi()
WebApi.credentials_set(
appName='<credentials from allegro>',
clientId='<credentials from allegro>',
clientSecred='<credentials from allegro>',
userLogin='<allegro login>',
redirectUrl='<redirect uri - the same you provided during app registration on allegro >',
appPassword='<app password>'
)
RestApi = AllegroRestApi()
RestApi.credentials_set(
appName='<credentials from allegro>',
clientId='<credentials from allegro>',
clientSecred='<credentials from allegro>',
redirectUrl='http://localhost:8000'
)
如何使用小快板:
Allegro API文档:
参考文献
感谢:
- https://cwsi.pl/ecommerce/allegro/podstawy-obslugi-web-api-allegro-pl-web-services-i-modul-suds-jurko-w-pythonie
- https://cwsi.pl/ecommerce/allegro/allegro-pl-rest-api-w-pythonie-wprowadzenie/
待办事项
- [X]在PYPI上发布包
- []重新启动输入
- []重新启动删除
- []重新启动后
变更日志
版本。0.1.0:
- 自动令牌刷新
版本。0.1.1,0.2.0:
- 在
RestApi.resource_get()
方法中自动加载令牌
版本。0.3.0:
- 在webapi中添加了
response2JSON()
函数-将suds响应转换为json。