Open savex83 opened 4 years ago
@savex83 Try this, you can vary the siteids. Check the siteid ref.
import json
from ebaysdk.shopping import Connection as Shopping
def savetofile(outfn, dict):
with open(outfn, 'w') as f:
f.write(json.dumps(dict, indent=4))
def ship_category_info(outfn):
"""
siteid ref: https://developer.ebay.com/DevZone/merchandising/docs/Concepts/SiteIDToGlobalID.html
"""
siteids = {'us': '0', 'france': '71', 'italy': '101', 'spain': '186'}
api = Shopping(config_file='my_ebay.yaml', siteid=siteids['italy'])
cat_id = -1
try:
response = api.execute('GetCategoryInfo',
{'CategoryID': cat_id,
'IncludeSelector': 'ChildCategories'
})
r = response.dict()
except ConnectionError as e:
print(e)
print(e.response.dict())
except Exception:
print('Unexpected exception')
raise
savetofile(outfn, r)
if __name__ == '__main__':
outfn = 'shopping_cat.json'
ship_category_info(outfn)
shopping_cat.json
{
"Timestamp": "2020-06-07T10:17:25.910Z",
"Ack": "Success",
"Build": "E1141_CORE_APILW_19170841_R1",
"Version": "1141",
"CategoryArray": {
"Category": [
{
"CategoryID": "-1",
"CategoryLevel": "0",
"CategoryName": "Root",
"CategoryParentID": "0",
"LeafCategory": "false"
},
{
"CategoryID": "11450",
"CategoryLevel": "1",
"CategoryName": "Abbigliamento e accessori",
"CategoryParentID": "-1",
"CategoryNamePath": "Abbigliamento e accessori",
"CategoryIDPath": "11450",
"LeafCategory": "false"
},
{
"CategoryID": "353",
"CategoryLevel": "1",
"CategoryName": "Arte e antiquariato",
"CategoryParentID": "-1",
"CategoryNamePath": "Arte e antiquariato",
"CategoryIDPath": "353",
"LeafCategory": "false"
},
...
Please close this issue if this works for you.
I'm also having issues with this
api_shopping = Shopping(appid="<appid>",
certid='<certid>',
devid='<devid>,
config_file=None,
iaf_token=load_settings['oauth'],
token=load_settings['token'],
siteid="EBAY-GB")
response_shopping = api_shopping.execute('GetMultipleItems', {'ItemID': item_id_list})
The problem is that the returned links are for the ebay US site which is a problem because on the US site any 'multiple item' discounts are not applied.
Another quick question, is it possible to get the available discount for an item through the api?
example
I'm trying to get GetCategoryInfo in different languages, but if I set the siteid I get always english. Thank you