from ebay.trading import AddItemRequest import ebay ############################################################# #Testing default condition( No arguments passed) #Expecting global headers to be used #And sandbox token to be used ############################################################# add_item = AddItemRequest() print "*" * 30 print "Testing no arguments passed ( defaults on None )" print "Headers: %s" % add_item.headers print "Token: %s" % add_item.token print "*" * 30 ############################################################## #Testing condition when headers and token are user input #Expecting headers and token to be set to those values(given that headers is correct) # ############################################################## headers = { "X-EBAY-API-COMPATIBILITY-LEVEL": '666', "X-EBAY-API-CALL-NAME": "SOMETHING RIDICULOUS", "X-EBAY-API-SITEID": "0", "Content-Type": "text/xml" } add_item1 = AddItemRequest(headers, 'ABC...123') print "*" * 30
''' This script will test the entire lifecycle of an eBay API request. It will test creating a request, and building the xml dom. And then it will create a connection, building appropriate headers and send the request to the proper eBay server ''' from ebay.trading import AddItemRequest import ebay import uuid #Create an AddItemRequest with default settings #Settings include: GlobalConfiguration of headers and auth-token #All in the sandbox environment(default) add_item = AddItemRequest( ) #The data structure to send to the AddItemRequest #This example creates an auction that lasts 7 days, #And offers a flat rate shipping to only the US data = { 'listing_type': 'Chinese', 'picture_details': { 'picture_url' : 'http://i1.sandbox.ebayimg.com/03/i/00/a6/17/13_1.JPG?set_id=8800005007', }, 'subtitle': 'Hello!', 'sku': '13523-358', 'uuid': str(uuid.uuid4()).replace("-",""), 'description': 'THis is a test example, woo hoo!', 'buy_it_now_price': 100.00,
import sys from ebay.trading import AddItemRequest from ebay.trading import EndItemRequest # OR #from ebay.trading import * from lxml import etree ########################################## # # Testing AddItem # ########################################## request = AddItemRequest( False, 'ABC...123' ) request.update( { 'listing_type': 'Chinese', 'picture_details': { 'picture_url' : 'http://i1.sandbox.ebayimg.com/03/i/00/a6/17/13_1.JPG?set_id=8800005007', }, 'subtitle': 'Hello!', 'sku': '13523-358', 'uuid': '3285-972389-57403587-34957', 'description': 'THis is a test example, woo hoo!', 'buy_it_now_price': 100.00, 'condition_id': '1000', 'category_mapping_allowed': 'True', 'pay_pal_email_address': '*****@*****.**', 'title': 'Super Dooper Awesome Megacool Helmet',