| Line 36... |
Line 36... |
| 36 |
params['ExcludeMe']='true'
|
36 |
params['ExcludeMe']='true'
|
| 37 |
params.update(extra_data)
|
37 |
params.update(extra_data)
|
| 38 |
request_description = '&'.join(['%s=%s' % (k, urllib.quote(params[k], safe='-_.~').encode('utf-8')) for k in sorted(params)])
|
38 |
request_description = '&'.join(['%s=%s' % (k, urllib.quote(params[k], safe='-_.~').encode('utf-8')) for k in sorted(params)])
|
| 39 |
signature = self.calc_signature(method, request_description)
|
39 |
signature = self.calc_signature(method, request_description)
|
| 40 |
url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, urllib.quote(signature))
|
40 |
url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, urllib.quote(signature))
|
| - |
|
41 |
print url
|
| 41 |
headers = {'User-Agent': 'AmazonJavascriptScratchpad/1.0 (Language=Python)'}
|
42 |
#headers = {'User-Agent': 'AmazonJavascriptScratchpad/1.0 (Language=Python)'}
|
| 42 |
headers.update(kwargs.get('extra_headers', {}))
|
43 |
#headers.update(kwargs.get('extra_headers', {}))
|
| 43 |
response = request(method, url)
|
44 |
response = request(method, url)
|
| 44 |
if action=='GetLowestOfferListingsForSKU':
|
45 |
if action=='GetLowestOfferListingsForSKU':
|
| 45 |
return self.parse_competitor_pricing_response(response)
|
46 |
return self.parse_competitor_pricing_response(response)
|
| 46 |
elif action=='GetMyPriceForSKU':
|
47 |
elif action=='GetMyPriceForSKU':
|
| 47 |
return self.parse_my_pricing_response(response)
|
48 |
return self.parse_my_pricing_response(response)
|
| Line 73... |
Line 74... |
| 73 |
except:
|
74 |
except:
|
| 74 |
temp['shippingTime'] = '0-0'
|
75 |
temp['shippingTime'] = '0-0'
|
| 75 |
try:
|
76 |
try:
|
| 76 |
temp['rating'] = (offer.getElementsByTagName('SellerPositiveFeedbackRating')[0].firstChild.nodeValue)
|
77 |
temp['rating'] = (offer.getElementsByTagName('SellerPositiveFeedbackRating')[0].firstChild.nodeValue)
|
| 77 |
if temp['rating'] == 'Just Launched':
|
78 |
if temp['rating'] == 'Just Launched':
|
| 78 |
temp['rating'] = '0'
|
79 |
temp['rating'] = '100'
|
| 79 |
else:
|
80 |
else:
|
| 80 |
str_rating = temp['rating'].replace('-',' ').replace('%','')
|
81 |
str_rating = temp['rating'].replace('-',' ').replace('%','')
|
| 81 |
a = str_rating.split()
|
82 |
a = str_rating.split()
|
| 82 |
l = []
|
83 |
l = []
|
| 83 |
for x in a:
|
84 |
for x in a:
|
| Line 105... |
Line 106... |
| 105 |
fulfillmentChannel = offer.getElementsByTagName('FulfillmentChannel')[0].firstChild.nodeValue
|
106 |
fulfillmentChannel = offer.getElementsByTagName('FulfillmentChannel')[0].firstChild.nodeValue
|
| 106 |
amount = offer.getElementsByTagName('Amount')[0].firstChild.nodeValue
|
107 |
amount = offer.getElementsByTagName('Amount')[0].firstChild.nodeValue
|
| 107 |
try:
|
108 |
try:
|
| 108 |
rating = (offer.getElementsByTagName('SellerPositiveFeedbackRating')[0].firstChild.nodeValue)
|
109 |
rating = (offer.getElementsByTagName('SellerPositiveFeedbackRating')[0].firstChild.nodeValue)
|
| 109 |
if rating == 'Just Launched':
|
110 |
if rating == 'Just Launched':
|
| 110 |
rating = 0
|
111 |
rating = 100
|
| 111 |
else:
|
112 |
else:
|
| 112 |
str_rating = rating.replace('-',' ').replace('%','')
|
113 |
str_rating = rating.replace('-',' ').replace('%','')
|
| 113 |
a = str_rating.split()
|
114 |
a = str_rating.split()
|
| 114 |
l = []
|
115 |
l = []
|
| 115 |
for x in a:
|
116 |
for x in a:
|
| Line 203... |
Line 204... |
| 203 |
num+=1
|
204 |
num+=1
|
| 204 |
return self.make_request(data,'GetLowestOfferListingsForSKU')
|
205 |
return self.make_request(data,'GetLowestOfferListingsForSKU')
|
| 205 |
|
206 |
|
| 206 |
def main():
|
207 |
def main():
|
| 207 |
p = Products("AKIAII3SGRXBJDPCHSGQ", "B92xTbNBTYygbGs98w01nFQUhbec1pNCkCsKVfpg", "AF6E3O0VE0X4D")
|
208 |
p = Products("AKIAII3SGRXBJDPCHSGQ", "B92xTbNBTYygbGs98w01nFQUhbec1pNCkCsKVfpg", "AF6E3O0VE0X4D")
|
| 208 |
comp = p.get_competitive_pricing_for_sku('A21TJRUUN4KGV', ['FBA12248','FBA10969'])
|
209 |
comp = p.get_competitive_pricing_for_sku('A21TJRUUN4KGV', ['FBA16933'])
|
| 209 |
#our = p.get_my_pricing_for_sku('A21TJRUUN4KGV', ['FBB12248'])
|
210 |
our = p.get_my_pricing_for_sku('A21TJRUUN4KGV', ["FBA10660"])
|
| 210 |
print comp[1]
|
211 |
print our
|
| 211 |
#print our
|
212 |
print comp
|
| - |
|
213 |
# for k, v in our.iteritems():
|
| - |
|
214 |
# print k,
|
| - |
|
215 |
# print '\t',
|
| - |
|
216 |
# print v['sellingPrice'],
|
| - |
|
217 |
# print v['promoPrice'],
|
| - |
|
218 |
# print v['asin']
|
| 212 |
#print our.get('promotion')
|
219 |
#print our.get('promotion')
|
| 213 |
# print comp.get('FBA12248')
|
220 |
# print comp.get('FBA12248')
|
| 214 |
# print our.get('FBA12248')
|
221 |
# print our.get('FBA12248')
|
| 215 |
# x = (our.get('FBA12248'))
|
222 |
# x = (our.get('FBA12248'))
|
| 216 |
# x['sellingPrice']=41089
|
223 |
# x['sellingPrice']=41089
|
| Line 218... |
Line 225... |
| 218 |
# l.append((our.get('FBA12248')))
|
225 |
# l.append((our.get('FBA12248')))
|
| 219 |
# print sorted(l, key=itemgetter('promoPrice','notOurSku'))
|
226 |
# print sorted(l, key=itemgetter('promoPrice','notOurSku'))
|
| 220 |
|
227 |
|
| 221 |
|
228 |
|
| 222 |
if __name__=='__main__':
|
229 |
if __name__=='__main__':
|
| 223 |
main()
|
- |
|
| 224 |
|
230 |
main()
|
| - |
|
231 |
|