-
Notifications
You must be signed in to change notification settings - Fork 325
Trading API Class
The eBay Trading API offers secure, authenticated access to private eBay data. Use the eBay Trading API to build applications such as selling and post-sales management applications, manage User information, and initiate the item purchase flow on eBay.
from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
try:
api = Trading(appid="YOUR_APPID", devid="YOUR_DEVID", certid="YOUR_CERTID", token="YOUR_AUTH_TOKEN", config_file=None)
response = api.execute('GetUser', {})
print(response.dict())
print(response.reply)
except ConnectionError as e:
print(e)
print(e.response.dict())
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 this name, it will automatically get picked up.
from ebaysdk.trading import Connection as Trading
api = Trading(config_file='myfile.yaml')
response = api.execute('GetUser', {})
print(response.dict())
print(response.reply)
from ebaysdk.trading import Connection as Trading
api = Trading(domain='api.sandbox.ebay.com',
appid="YOUR_APPID", devid="YOUR_DEVID", certid="YOUR_CERTID", token="YOUR_AUTH_TOKEN")
response = api.execute('GetUser', {})
print(response.dict())
print(response.reply)
Keyword arguments to Trading() constructor
domain -- API endpoint (default: api.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: /ws/api.dll)
appid -- eBay application id
devid -- eBay developer id
certid -- eBay cert id
token -- eBay application/user token
siteid -- eBay country site id (default: 0 (US))
compatibility -- version number (default: 648)
https -- execute of https (default: True)
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 the HTTP request.
response = api.execute('GetUser', {})
Returns a string of the HTTP call errors
if api.error():
print "has errors: %s" % api.error()
Return a DOM object (lxml dom) of the HTTP response content.
Return a dictionary of the HTTP response content.
Return the string content from the HTTP response call.
Return a response data object.
Return the HTTP response code.
Return the HTTP response status.
Return an array of eBay response codes.
- Unpaid Item Disputes
- Listing Items
- Retrieving the Category Hierarchy for a Site
- Retrieving the Data for One Item
- Retrieving the Order Line Items for a Single Item
- Retrieving the Order Line Items for a Specific Seller
- Retrieving User Information
- Searching for Items
- Working with Seller Events