google购物api的python客户端
python-google-shopping的Python项目详细描述
用于google content api v2的python客户端
安装
pip install python-google-shopping
功能
- 通过env变量以sanly方式处理oauth2
- 使用迭代器处理分页
- 将校验和自动添加到产品的gtin中
- 与django和其他框架配合良好
用法
基本
exportGOOGLE_SHOPPING_CLIENT_ID=my_client_id exportGOOGLE_SHOPPING_CLIENT_SECRET=my_client_secret exportGOOGLE_SHOPPING_REFRESH_TOKEN=my_refresh_token
fromgoogle_shoppingimportMerchantmerchant_id='536476575676'merchant=Merchant(merchant_id,country_code='AU')# Get product resourceproduct_resource=merchant.products.get(1234)# Get all productsproducts=list(merchant.products.list())# Iterate through products (generator)forproductinmerchant.products.list():printproduct.title# Delete product resourceproduct=Product.objects.order_by('?').first()merchant.products.delete(product.id)