Skip to content
Seifollahi edited this page Aug 31, 2020 · 14 revisions

We optimized the eBay Shopping APIs for size, speed and usability. The lightweight APIs access public eBay data in the Web 2.0 world. Search for eBay items, products and reviews, user info, and popular items and searches. Retrieve public eBay data in a buyer-friendly view, for easy consumption by widgets, search tools, and other buyer-focused applications.

Usage

from ebaysdk.shopping import Connection as Shopping
try:    
    api = Shopping(appid="YOUR_APPID", config_file=None)
    response = api.execute('FindPopularItems', {'QueryKeywords': 'Python'})
    print(response.dict())
    print(response.reply)
except ConnectionError as e:
    print(e)
    print(e.response.dict())

Usage With YAML

Place a YAML file in your home or /etc/ directory and reference that filename when constructing the object. The default YAML filename is "ebay.yaml", if you use "ebay.yaml" name, it will get picked up automatically.

from ebaysdk.shopping import Connection as Shopping
api = Shopping(config_file='myfile.yaml')
response = api.execute('FindPopularItems', {'QueryKeywords': 'Python'})
print(response.dict())

Sandbox Usage

from ebaysdk.shopping import Connection as Shopping
api = Shopping(domain='svcs.sandbox.ebay.com', appid="YOUR_APPID")
response = api.execute('FindPopularItems', {'QueryKeywords': 'Python'})
print(response.dict())

Public Methods

Shopping(**kwargs)

Keyword arguments to Shopping() constructor

domain        -- API endpoint (default: svcs.ebay.com)
config_file   -- YAML defaults (default: ebay.yaml)
debug         -- debugging enabled (default: False)
warnings      -- warnings enabled (default: False)
errors        -- warnings enabled (default: True)    
uri           -- API endpoint uri (default: /services/search/FindingService/v1)
appid         -- eBay application id
siteid        -- eBay country site id (default: EBAY-US)
compatibility -- version number (default: 1.0.0)
https         -- execute of https (default: False)
proxy_host    -- proxy hostname
proxy_port    -- proxy port number
timeout       -- HTTP request timeout (default: 20)
parallel      -- ebaysdk parallel object
response_encoding -- API encoding (default: XML)
request_encoding  -- API encoding (default: XML)

execute(verb, data)

Execute the HTTP request.

response = api.execute('FindPopularItems', {'QueryKeywords': 'Python'})

error()

Returns a string of the HTTP call errors

if api.error():
    print "has errors: %s" % api.error()

response.reply

Returns a response data object

response.dom()

Return a DOM object (lxml dom) of the HTTP response content.

response.dict()

Return a dictionary of the HTTP response content.

response.content

Return the string content from the HTTP response call.

response_code()

Return the HTTP response code.

response_status()

Return the HTTP response status.

response_codes()

Return an array of eBay response codes.

API Use Cases

see more

More Examples

see samples