Passhub API客户端
sightseeingtech-passhub-api的Python项目详细描述
passhub api客户端
Passhub API文档
使用python访问passhub。此模块提供对api的高级和低级调用。
要求。
python 2.7和3.4+
安装和使用
pip安装
如果python包托管在github上,则可以直接从github安装
pip install sightseeingtech_passhub_api
(您可能需要使用根权限运行pip
:sudo pip install sightseeingtech_passhub_api
)
然后导入包:
importsightseeingtech_passhub_api
设置工具
通过Setuptools安装。
python setup.py install --user
(或sudo python setup.py install
为所有用户安装软件包)
然后导入包:
importsightseeingtech_passhub_api
开始
请按照installation procedure操作,然后运行以下命令:
from__future__importprint_functionimporttimeimportsightseeingtech_passhub_apifromsightseeingtech_passhub_api.restimportApiExceptionfrompprintimportpprintconfiguration=Configuration()configuration.api_key['X-Api-Key']='YOUR_API_KEY'configuration.host='YOUR_HOST'configuration.verify_ssl=Falseclient=ApiClient(configuration)try:productResourceApi=sightseeingtech_passhub_api.ProductResourceApi(client)print('Loading products...')products=productResourceApi.get_all_products()print('Product %d products is/are loaded.\n'%len(products))exceptApiExceptionase:print("Exception when calling ProductResourceApi->get_all_products: %s\n"%e)
API端点文档
Class | Method | HTTP request | Description |
---|---|---|---|
OrderRecordResourceApi | createOrderRecord | POST /api/v1/orderRecords | createOrderRecord |
OrderRecordResourceApi | getAllOrderRecords | GET /api/v2/orderRecords | getAllOrderRecords |
OrderRecordResourceApi | getOrderRecord | GET /api/v1/orderRecords/{id} | getOrderRecord |
OrderRecordResourceApi | mergeVouchers | POST /api/v1/orderRecords/mergeVouchers | mergeVouchers |
OrderRecordResourceApi | updateOrderRecord) | PUT /api/v1/orderRecords | updateOrderRecord |
ProductResourceApi | findProductsByVendor | GET /api/v1/products/vendor/{vendorId} | findProductsByVendor |
ProductResourceApi | getAllProducts | GET /api/v2/products | getAllProducts |
VendorResourceApi | getAllVendors | GET /api/v2/vendors | getAllVendors |
VoucherResourceApi | cancelValidation | POST /api/v2/voucher/validate/cancel | V2 Cancel validation for the voucher |
VoucherResourceApi | cancelVoucher | POST /api/v1/voucher/cancel | cancelVoucher |
VoucherResourceApi | convertVoucher | POST /api/v1/voucher/convert | convertVoucher |
VoucherResourceApi | validateVoucher | POST /api/v2/voucher/validate | [V2 Validates voucher which represents single order item or group of them. |
授权文件
X-API-键
- 类型:api键
- api密钥参数名:x-api-key
- 位置:http头