1616
1717sys .path .insert (0 , '%s/../' % os .path .dirname (__file__ ))
1818
19- from common import dump
19+ from common import dump , get_one_item
2020
2121import ebaysdk
2222from ebaysdk .exception import ConnectionError
@@ -37,8 +37,8 @@ def init_options():
3737 dest = "appid" , default = None ,
3838 help = "Specifies the eBay application id to use." )
3939 parser .add_option ("-n" , "--domain" ,
40- dest = "domain" , default = 'svcs .ebay.com' ,
41- help = "Specifies the eBay domain to use (e.g. svcs.sandbox .ebay.com)." )
40+ dest = "domain" , default = 'open.api .ebay.com' ,
41+ help = "Specifies the eBay domain to use (e.g. open.api .ebay.com)." )
4242
4343 (opts , args ) = parser .parse_args ()
4444 return opts , args
@@ -51,13 +51,12 @@ def run(opts):
5151 print ("Shopping samples for SDK version %s" % ebaysdk .get_version ())
5252
5353 try :
54- response = api . execute ( 'FindPopularItems' , { 'QueryKeywords' : 'Python' } )
54+ ItemID = get_one_item ( opts )
5555
56- dump (api )
56+ response = api .execute ('GetSingleItem' , {'ItemID' : ItemID })
57+ print ("EndTime: %s" % response .reply .Item .EndTime )
5758
58- print ("Matching Titles:" )
59- for item in response .reply .ItemArray .Item :
60- print (item .Title )
59+ dump (api )
6160
6261 except ConnectionError as e :
6362 print (e )
@@ -69,45 +68,22 @@ def popularSearches(opts):
6968 api = Shopping (debug = opts .debug , appid = opts .appid , config_file = opts .yaml , domain = opts .domain ,
7069 warnings = True )
7170
72- choice = True
73-
74- while choice :
75-
76- choice = input ('Search: ' )
77-
78- if choice == 'quit' :
79- break
80-
81- mySearch = {
82- "MaxKeywords" : 10 ,
83- "QueryKeywords" : choice ,
84- }
85-
86- try :
87- response = api .execute ('FindPopularSearches' , mySearch )
71+ mySearch = {
72+ "MaxKeywords" : 10 ,
73+ "QueryKeywords" : 'shirt' ,
74+ }
8875
89- dump (api , full = False )
90-
91- print ("Related: %s" %
92- response .reply .PopularSearchResult .RelatedSearches )
93-
94- for term in response .reply .PopularSearchResult .AlternativeSearches .split (';' )[:3 ]:
95- api .execute ('FindPopularItems' , {
96- 'QueryKeywords' : term , 'MaxEntries' : 3 })
76+ try :
77+ response = api .execute ('FindPopularSearches' , mySearch )
9778
98- print ("Term: %s" % term )
99- try :
100- for item in response .reply .ItemArray .Item :
101- print (item .Title )
102- except AttributeError :
103- pass
79+ dump (api , full = False )
10480
105- dump ( api )
106- print ( " \n " )
81+ print ( "Related: %s" %
82+ response . reply . PopularSearchResult . RelatedSearches )
10783
108- except ConnectionError as e :
109- print (e )
110- print (e .response .dict ())
84+ except ConnectionError as e :
85+ print (e )
86+ print (e .response .dict ())
11187
11288
11389def categoryInfo (opts ):
@@ -116,28 +92,12 @@ def categoryInfo(opts):
11692 api = Shopping (debug = opts .debug , appid = opts .appid , config_file = opts .yaml , domain = opts .domain ,
11793 warnings = True )
11894
119- response = api .execute ('GetCategoryInfo' , {"CategoryID" : 3410 })
120-
121- dump (api , full = False )
122-
123- except ConnectionError as e :
124- print (e )
125- print (e .response .dict ())
126-
127-
128- def with_affiliate_info (opts ):
129- try :
130- api = Shopping (debug = opts .debug , appid = opts .appid ,
131- config_file = opts .yaml , warnings = True ,
132- trackingid = 1234 , trackingpartnercode = 9 )
95+ response = api .execute ('GetCategoryInfo' , {"CategoryID" : 11450 })
13396
134- mySearch = {
135- "MaxKeywords" : 10 ,
136- "QueryKeywords" : 'shirt' ,
137- }
97+ print ("Category Name: %s" %
98+ response .reply .CategoryArray .Category [0 ].CategoryName )
13899
139- response = api .execute ('FindPopularSearches' , mySearch )
140- dump (api , full = False )
100+ dump (api )
141101
142102 except ConnectionError as e :
143103 print (e )
@@ -165,5 +125,4 @@ def using_attributes(opts):
165125 run (opts )
166126 popularSearches (opts )
167127 categoryInfo (opts )
168- with_affiliate_info (opts )
169128 using_attributes (opts )
0 commit comments