The JSON object returns in good shape and can be viewed with an online JSON tree viewer.
Here is the code snippet, followed by the XML object:
import ebaysdk
from ebaysdk.finding import Connection
from ebaysdk.exception import ConnectionError
print(dir(ebaysdk))
print("--------------")
print(dir(ebaysdk.finding.Connection)) # contains the API equivalent calls like response.dict()
print("--------------")
print(dir(ebaysdk.utils))
print("--------------")
if name == 'main':
Production Server
api = Connection(config_file='C:\\Users\\eBay_Sandbox\\Documents\\Finding\\ebay.yaml', siteid="EBAY-US")
request = {
'categoryId': 260,
'paginationInput': {
'entriesPerPage': 2,
'pageNumber': 1
},
'sortOrder': 'PricePlusShippingLowest',
'outputSelector': ['CategoryHistogram',
'AspectHistogram',
'ConditionHistogram',
'GalleryInfo',
'PictureURLLarge',
'PictureURLSuperSize',
'SellerInfo',
'StoreInfo',
'UnitPriceInfo']
} # just use every possible outputSelector values IN A LIST []
# and then cull what you need later
#https://developer.ebay.com/DevZone/finding/CallRef/extra/fnditmsbyctgry.rqst.tptslctr.html
response = api.execute('findItemsByCategory', request)
# turns dictionary into XML
print(ebaysdk.utils.dict2xml(response.dict()))
tree = ebaysdk.utils.dict2xml(response.dict())
print(tree)
print("--------------")
print(ebaysdk.utils.get_dom_tree(tree))
error occurs here.
-------------------- XML object -----------------------
Success<_name>Certification<_valueName>Briefmarkenprufstelle Basel8<_valueName>British Philatelic Association42<_valueName>Ceres1791<_valueName>Diena340<_valueName>Friedl22<_valueName>PF25814<_valueName>PSAG2158<_valueName>PSE49171<_valueName>Raybaudi176<_valueName>Robson Lowe249<_valueName>Royal Philatelic Society of London8<_valueName>Royal Philatelic Society of New Zealand3<_valueName>Royal Philatelic Society of Victoria2<_valueName>Sandeep Jaiswal1<_valueName>Sergio Sismondo27<_valueName>Uncertified2626354<_valueName>Vincent Graves Greene Foundation31<_valueName>Not Specified4003855<_name>Grade<_valueName>Gem42412<_valueName>Superb209052<_valueName>XF/S (Extremely Fine/Superb)64258<_valueName>XF (Extremely Fine)55607<_valueName>VF/XF (Very Fine/Extremely Fine)135357<_valueName>VF (Very Fine)531085<_valueName>F/VF (Fine/Very Fine)276236<_valueName>F (Fine)85052<_valueName>VG/F (Very Good/Fine)14907<_valueName>VG (Very Good)15564<_valueName>G/VG (Good/Very Good)12553<_valueName>G (Good)48976<_valueName>F/G (Fair/Good)4018<_valueName>F (Fair)4161<_valueName>P (Poor)664<_valueName>Not Specified3993782Stamps260Stamps4742Europe1581827261United States14869203499Great Britain6344604752Topical Stamps58843665174British Colonies & Territories485158181420Worldwide325808181416Asia2787073478Canada221750181424Australia & Oceania193127181423Africa163907181417Latin America153102181422Middle East1408857898Specialty Philately68262181421Publications & Supplies51134179377Caribbean38247170137Other Stamps300576733225https://www.ebay.com/sch/260/i.html?_dcat=260&_ddo=1&_ipg=2&_os=C%7CA%7CCD%7CGI%7CPL%7CPS%7CS%7CST%7CUP%7CD&_pgn=1&_sop=152167332253366613<_count>2falseUS<_gallerySize>Largehttps://thumbs4.ebaystatic.com/m/mo8yFw_n1G3MptlkHrmfEWQ/140.jpg<_gallerySize>Mediumhttps://thumbs4.ebaystatic.com/m/mo8yFw_n1G3MptlkHrmfEWQ/96.jpg<_gallerySize>Smallhttps://thumbs4.ebaystatic.com/m/mo8yFw_n1G3MptlkHrmfEWQ/80.jpghttps://thumbs4.ebaystatic.com/m/mo8yFw_n1G3MptlkHrmfEWQ/140.jpgEBAY-USfalse174366888475falsefalse2020-08-04T04:02:44.000ZfalseAuction2020-07-28T04:02:44.000Z1Braymer,MO,USAPayPalhttps://i.ebayimg.com/00/s/NzQ1WDEyODA=/z/zD0AAOSwbxFfH6Nn/$_1.JPGhttps://i.ebayimg.com/00/s/NzQ1WDEyODA=/z/zD0AAOSwbxFfH6Nn/$_3.JPG646**689Postal HistorytrueTurquoiseShooting3157799.8boydtmfalse1<_currencyId>USD0.01<_currencyId>USD0.01ActiveP0DT9H59M48Sfalse10falseWorldwide<_currencyId>USD0.0Freeboydtmhttp://stores.ebay.com/boydtm1¢ WONDER'S ~ US 1949 BAD AXE AIRPORT DEDICATION BEULAH MICHIGAN ~ L643falsehttps://www.ebay.com/itm/1-WONDERS-US-1949-BAD-AXE-AIRPORT-DEDICATION-BEULAH-MICHIGAN-L643-/174366888475falseCA<_gallerySize>Largehttps://thumbs2.ebaystatic.com/m/m2XzJPkSuNNidOkRER2mteg/140.jpg<_gallerySize>Mediumhttps://thumbs2.ebaystatic.com/m/m2XzJPkSuNNidOkRER2mteg/96.jpg<_gallerySize>Smallhttps://thumbs2.ebaystatic.com/m/m2XzJPkSuNNidOkRER2mteg/80.jpghttps://thumbs2.ebaystatic.com/m/m2XzJPkSuNNidOkRER2mteg/140.jpgEBAY-USfalse274444175429falsefalse2020-08-04T17:08:11.000ZfalseAuction2020-07-30T17:08:11.000Z3CanadaPayPalhttps://i.ebayimg.com/00/s/OTU4WDc2MA==/z/BZwAAOSwy-FfIv5z/$_1.JPGhttps://i.ebayimg.com/00/s/OTU4WDc2MA==/z/BZwAAOSwy-FfIv5z/$_12.JPG65182TurkeytruePurple92899.7egnatia_shopfalse1<_currencyId>USD0.01<_currencyId>USD0.01ActiveP0DT23H5M15Sfalse2falseWorldwide<_currencyId>USD0.0FreeEgnatia Shophttp://stores.ebay.com/Egnatia-ShopAlbania / Turkey VERY RARE ERROR handstamped Signed CV:€ 3,000 + #63falsehttps://www.ebay.com/itm/Albania-Turkey-VERY-RARE-ERROR-handstamped-Signed-CV-3-000-63-/2744441754292020-08-03T18:02:56.599Z1.13.0
Thonny IDE reports the following when I try to use utils.get_dom_tree()
Python exception: XMLSyntaxError: Extra content at the end of the document, line 1, column 19
I get an almost identical error message from a web based XML tree viewer tool:
https://countwordsfree.com/xmlviewer
The JSON object returns in good shape and can be viewed with an online JSON tree viewer.
Here is the code snippet, followed by the XML object:
import ebaysdk from ebaysdk.finding import Connection from ebaysdk.exception import ConnectionError
print(dir(ebaysdk)) print("--------------") print(dir(ebaysdk.finding.Connection)) # contains the API equivalent calls like response.dict() print("--------------") print(dir(ebaysdk.utils)) print("--------------")
if name == 'main':
Production Server
error occurs here.
-------------------- XML object -----------------------