| Line 51... |
Line 51... |
| 51 |
'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
51 |
'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
|
| 52 |
'Connection':'keep-alive',
|
52 |
'Connection':'keep-alive',
|
| 53 |
'Accept-Encoding' : 'gzip,deflate,sdch'
|
53 |
'Accept-Encoding' : 'gzip,deflate,sdch'
|
| 54 |
}
|
54 |
}
|
| 55 |
|
55 |
|
| - |
|
56 |
TRACK_URLS = []
|
| - |
|
57 |
TRACK_HEADERS = {
|
| - |
|
58 |
"sn":"2.VIBAC8BD9D21024F649B0482FAC385814A.SIE6C5F25D78974A5EB850D89167D52009.VSE7C76F85C2EE463786F89407CA46CA31.1492756338",
|
| - |
|
59 |
"Connection":"keep-alive",
|
| - |
|
60 |
"Referer":"https://www.flipkart.com/rv/orders?link=myAccounts",
|
| - |
|
61 |
"cache-control":"no-cache",
|
| - |
|
62 |
"Accept":"/",
|
| - |
|
63 |
"Accept-Language":"en-US,en;q=0.8",
|
| - |
|
64 |
"content-type":"application/json",
|
| - |
|
65 |
"User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML:like Gecko) Chrome/48.0.2564.23 Mobile Safari/537.36",
|
| - |
|
66 |
"flipkart_secure":"true",
|
| - |
|
67 |
"sc":"",
|
| - |
|
68 |
"Accept-Encoding":"gzip:deflate:sdch:br",
|
| - |
|
69 |
"x-user-agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML:like Gecko) Chrome/48.0.2564.23 Mobile Safari/537.36 FKUA/msite/0.0.1/msite/Mobile,Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML:like Gecko) Chrome/48.0.2564.23 Mobile Safari/537.36 FKUA/msite/0.0.1/msite/Mobile",
|
| - |
|
70 |
"pragma":"no-cache",
|
| - |
|
71 |
"issecureresource":"true"
|
| - |
|
72 |
}
|
| - |
|
73 |
|
| - |
|
74 |
|
| 56 |
class Store(MStore):
|
75 |
class Store(MStore):
|
| 57 |
OrderStatusMap = {
|
76 |
OrderStatusMap = {
|
| 58 |
main.Store.ORDER_PLACED : ['approval', 'processing', 'shipping'],
|
77 |
main.Store.ORDER_PLACED : ['approval', 'processing', 'shipping'],
|
| 59 |
main.Store.ORDER_DELIVERED : ['your item has been delivered'],
|
78 |
main.Store.ORDER_DELIVERED : ['your item has been delivered'],
|
| 60 |
main.Store.ORDER_SHIPPED : ['in transit', 'shipment yet to be delivered'],
|
79 |
main.Store.ORDER_SHIPPED : ['in transit', 'shipment yet to be delivered'],
|
| Line 67... |
Line 86... |
| 67 |
super(Store, self).__init__(store_id)
|
86 |
super(Store, self).__init__(store_id)
|
| 68 |
|
87 |
|
| 69 |
def getName(self):
|
88 |
def getName(self):
|
| 70 |
return "flipkart"
|
89 |
return "flipkart"
|
| 71 |
|
90 |
|
| - |
|
91 |
def trackOrdersForUser(self, userId, url, rawHtml):
|
| - |
|
92 |
rawHtml = re.sub(r'[^\x00-\x7F]+',' ', rawHtml)
|
| - |
|
93 |
if url not in TRACK_URLS:
|
| - |
|
94 |
for lis in re.findall('SN:"(.*?)"', rawHtml):
|
| - |
|
95 |
TRACK_HEADERS['sn'] = lis
|
| - |
|
96 |
break
|
| - |
|
97 |
for lis in re.findall('SN:"(.*?)"', rawHtml):
|
| - |
|
98 |
TRACK_HEADERS['User-Agent'] = lis.split(" fkUA")[0]
|
| - |
|
99 |
TRACK_HEADERS['x-user-agent'] = lis
|
| - |
|
100 |
break
|
| - |
|
101 |
|
| - |
|
102 |
return {"headers":TRACK_HEADERS, "urls":TRACK_URLS}
|
| - |
|
103 |
else:
|
| - |
|
104 |
return 'PARSED_SUCCESS'
|
| - |
|
105 |
#parse json here
|
| - |
|
106 |
#jsonObject = json.loads(readSSh("/home/amit/node/serve/res.json"))
|
| - |
|
107 |
|
| 72 |
|
108 |
|
| 73 |
def requestDownload(self):
|
109 |
def requestDownload(self):
|
| 74 |
#"https://affiliate.flipkart.com/downloads/a_downloadRequest?type=OrdersReport¶meters=%7B%22filter%22%3A%22approved%22%2C%22till%22%3A%222015-10-03%22%2C%22from%22%3A%222015-04-03%22%7D"
|
110 |
#"https://affiliate.flipkart.com/downloads/a_downloadRequest?type=OrdersReport¶meters=%7B%22filter%22%3A%22approved%22%2C%22till%22%3A%222015-10-03%22%2C%22from%22%3A%222015-04-03%22%7D"
|
| 75 |
requestReportUrl = "https://affiliate.flipkart.com/downloads/a_downloadRequest?type=OrdersReport¶meters=%s"
|
111 |
requestReportUrl = "https://affiliate.flipkart.com/downloads/a_downloadRequest?type=OrdersReport¶meters=%s"
|
| 76 |
br = getBrowserObject()
|
112 |
br = getBrowserObject()
|