user5721764
user5721764

Reputation:

Ebay API / ebaysdk "GetSellerList"

I'm trying to retrieve the active and completed items under a list of specified sellers. I've read a few things in a few different places, but haven't really been able to find something that I understand or anything I could work with. I think it might have something to do with my headers or maybe authentication or something, but I'm also uncertain if its just the way that I'm setting up my request. I have only ever used the Finding API, and it looks like I need to use Trading instead, but I'm not sure what little details I might be missing when I tried to switch API's

from ebaysdk.trading import Connection as trading
api = trading(appid='API_KEY_HERE', config_file=None)

api_request = {
'keywords': 'new'}
'outputSelector': 'SellerInfo',
'itemFilter': [
    {'name': 'UserId',
    'value': 'SELLER_NAME_HERE'},
    {'name': 'StartTimeFrom',
    'value': QueryTime_Start},
    {'name': 'StartTimeTo',
    'value': QueryTime_Complete}]}

response = api.execute('GetSellerList', api_request).

and my complete error message:

Traceback (most recent call last): File "C:\Users\dc500\Downloads\All 3.0\All 3\Python\3Pies\Project_Ordered Tools\practice_getsellerlist.py", line 24, in response = api.execute('GetSellerList', api_request) File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\site-packages\ebaysdk\connection.py", line 120, in execute self.execute_request() File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\site-packages\ebaysdk\connection.py", line 184, in execute_request allow_redirects=True File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\adapters.py", line 376, in send timeout=timeout File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen body=body, headers=headers) File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 353, in _make_request conn.request(method, url, **httplib_request_kw) File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1084, in request self._send_request(method, url, body, headers) File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1124, in _send_request self.putheader(hdr, value) File "C:\Users\dc500\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1060, in putheader if _is_illegal_header_value(values[i]): TypeError: expected string or bytes-like object

Upvotes: 0

Views: 1164

Answers (1)

Alex Hellier
Alex Hellier

Reputation: 485

from ebaysdk.trading import Connection as Trading
try:
    api = Trading(config_file='ebay.yaml')
except ConnectionError as e:
    print(e)
    print(e.response.dict())
    log.error('Attempting to get an API object failed with %s', e)

def get_active_listings(page):
    acitvelist = api.execute('GetMyeBaySelling', {'ActiveList': True,
                                              'DetailLevel': 'ReturnAll',
                                              'PageNumber': page})
    return acitvelist.dict()

This works for me and returns all active listings - maybe GetMyeBaySellingis a better call to use ?

Other than that https://developer.ebay.com/devzone/XML/docs/Reference/eBay/GetSellerList.html#Input

does not seem to give the inputFilter as an option for parameters? there is outputSelector

??

Upvotes: 1

Related Questions