| Line 25... |
Line 25... |
| 25 |
from pyquery import PyQuery as pq
|
25 |
from pyquery import PyQuery as pq
|
| 26 |
import re
|
26 |
import re
|
| 27 |
import time
|
27 |
import time
|
| 28 |
import traceback
|
28 |
import traceback
|
| 29 |
import urllib2
|
29 |
import urllib2
|
| - |
|
30 |
import urlparse
|
| 30 |
|
31 |
|
| 31 |
ORDER_REDIRECT_URL = 'https://www.amazon.in/gp/css/summary/edit.html?orderID=%s'
|
32 |
ORDER_REDIRECT_URL = 'https://www.amazon.in/gp/css/summary/edit.html?orderID=%s'
|
| 32 |
ORDER_SUCCESS_URL = 'https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html'
|
33 |
ORDER_SUCCESS_URL = 'https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html'
|
| 33 |
THANKYOU_URL = 'https://www.amazon.in/gp/buy/thankyou/handlers/display.html'
|
34 |
THANKYOU_URL = 'https://www.amazon.in/gp/buy/thankyou/handlers/display.html'
|
| 34 |
AMAZON_AFF_URL = 'https://assoc-datafeeds-eu.amazon.com/datafeed/listReports'
|
35 |
AMAZON_AFF_URL = 'https://assoc-datafeeds-eu.amazon.com/datafeed/listReports'
|
| Line 59... |
Line 60... |
| 59 |
try:
|
60 |
try:
|
| 60 |
orderUrl = doc('a.a-touch-link').attr.href
|
61 |
orderUrl = doc('a.a-touch-link').attr.href
|
| 61 |
merchantOrderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
|
62 |
merchantOrderId = re.findall(r'.*&oid=(.*)&?.*?', orderUrl)[0]
|
| 62 |
except:
|
63 |
except:
|
| 63 |
merchantOrderId = doc("#orders-list>div>span>b").html()
|
64 |
merchantOrderId = doc("#orders-list>div>span>b").html()
|
| - |
|
65 |
if not merchantOrderId:
|
| - |
|
66 |
merchantOrderId = urlparse.parse_qs(urlparse.urlsplit(orderSuccessUrl).query)
|
| - |
|
67 |
else:
|
| - |
|
68 |
raise
|
| 64 |
order = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl, True)
|
69 |
order = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl, True)
|
| 65 |
order.orderTrackingUrl = ORDER_REDIRECT_URL % (merchantOrderId)
|
70 |
order.orderTrackingUrl = ORDER_REDIRECT_URL % (merchantOrderId)
|
| 66 |
order.orderSuccessUrl = orderSuccessUrl
|
71 |
order.orderSuccessUrl = orderSuccessUrl
|
| 67 |
order.merchantOrderId = merchantOrderId
|
72 |
order.merchantOrderId = merchantOrderId
|
| 68 |
order.requireDetail = True
|
73 |
order.requireDetail = True
|