| Line 225... |
Line 225... |
| 225 |
productCode = jsonSubOrderDetails['product_code']
|
225 |
productCode = jsonSubOrderDetails['product_code']
|
| 226 |
productImgUrl = jsonSubOrderDetails['images']['image_path'][0]
|
226 |
productImgUrl = jsonSubOrderDetails['images']['image_path'][0]
|
| 227 |
productDetailsSubMap['productCode']=productCode
|
227 |
productDetailsSubMap['productCode']=productCode
|
| 228 |
productDetailsSubMap['imgUrl']=productImgUrl
|
228 |
productDetailsSubMap['imgUrl']=productImgUrl
|
| 229 |
'''
|
229 |
'''
|
| 230 |
br1 = getBrowserObject()
|
- |
|
| 231 |
orderTrackingPage = br1.open(BASE_URL+subOrderTrackingParsingUrl)
|
230 |
orderTrackingPage = fetchResponseUsingProxy(BASE_URL+subOrderTrackingParsingUrl)
|
| 232 |
headers = str(orderTrackingPage.info()).split('\n')
|
- |
|
| 233 |
orderTrackingPage= ungzipResponse(orderTrackingPage)
|
- |
|
| 234 |
jsonResponse = None
|
- |
|
| 235 |
for header in headers:
|
- |
|
| 236 |
header = header.split(':')
|
- |
|
| 237 |
if header[0] == 'Content-Type' and 'json' in header[1]:
|
- |
|
| 238 |
jsonResponse = json.loads(orderTrackingPage)
|
- |
|
| 239 |
|
- |
|
| 240 |
orderTrackingPageSoup = None
|
- |
|
| 241 |
if jsonResponse is not None:
|
- |
|
| 242 |
orderTrackingPageSoup = BeautifulSoup(str(jsonResponse['text']))
|
- |
|
| 243 |
else:
|
- |
|
| 244 |
orderTrackingPageSoup = BeautifulSoup(orderTrackingPage)
|
231 |
orderTrackingPageSoup = BeautifulSoup(orderTrackingPage)
|
| 245 |
'''
|
232 |
'''
|
| 246 |
subOrderStatusList = orderTrackingPageSoup.findAll(attrs={'class' : 'price ord_status'})
|
233 |
subOrderStatusList = orderTrackingPageSoup.findAll(attrs={'class' : 'price ord_status'})
|
| 247 |
subOrderStatus = subOrderStatusList[0].contents[0].strip()
|
234 |
subOrderStatus = subOrderStatusList[0].contents[0].strip()
|
| 248 |
subOrderStatusTime= orderTrackingPageSoup.findAll(attrs={'class' : 'sts no_mobile'})[1].contents[2].strip()
|
235 |
subOrderStatusTime= orderTrackingPageSoup.findAll(attrs={'class' : 'sts no_mobile'})[1].contents[2].strip()
|
| 249 |
productDetailsSubMap['subOrderStatus'] = subOrderStatus
|
236 |
productDetailsSubMap['subOrderStatus'] = subOrderStatus
|
| Line 409... |
Line 396... |
| 409 |
else:
|
396 |
else:
|
| 410 |
discount = 0
|
397 |
discount = 0
|
| 411 |
subtotal = long(cols[4].text.strip().replace("Rs.","").replace(',',''))
|
398 |
subtotal = long(cols[4].text.strip().replace("Rs.","").replace(',',''))
|
| 412 |
else:
|
399 |
else:
|
| 413 |
subtotal = long(cols[3].text.strip().replace("Rs.","").replace(',',''))
|
400 |
subtotal = long(cols[3].text.strip().replace("Rs.","").replace(',',''))
|
| 414 |
br = getBrowserObject()
|
- |
|
| 415 |
productPage = br.open(BASE_MURL+productUrl)
|
401 |
productPage = fetchResponseUsingProxy(BASE_MURL+productUrl)
|
| 416 |
productPageHeaders = str(productPage.info()).split('\n')
|
- |
|
| 417 |
productPage = ungzipResponse(productPage)
|
- |
|
| 418 |
jsonProductResponse = None
|
- |
|
| 419 |
for header in productPageHeaders:
|
- |
|
| 420 |
header = header.split(':')
|
- |
|
| 421 |
if header[0] == 'Content-Type' and 'json' in header[1]:
|
- |
|
| 422 |
jsonProductResponse = json.loads(productPage)
|
- |
|
| 423 |
productPageSoup= None
|
- |
|
| 424 |
if jsonProductResponse is not None:
|
- |
|
| 425 |
productPageSoup = BeautifulSoup(jsonProductResponse['text'])
|
- |
|
| 426 |
else:
|
- |
|
| 427 |
productPageSoup = BeautifulSoup(productPage)
|
402 |
productPageSoup = BeautifulSoup(productPage)
|
| 428 |
productCode = productPageSoup.find('input', {'type':'hidden'})['value']
|
403 |
productCode = productPageSoup.find('input', {'type':'hidden'})['value']
|
| 429 |
allproductImageTags = productPageSoup.findAll(attrs={'class' : 'pd-image'})
|
404 |
allproductImageTags = productPageSoup.findAll(attrs={'class' : 'pd-image'})
|
| 430 |
productImgUrl = ''
|
405 |
productImgUrl = ''
|
| 431 |
if allproductImageTags is not None and len(allproductImageTags)>0:
|
406 |
if allproductImageTags is not None and len(allproductImageTags)>0:
|
| 432 |
productImgUrl= allproductImageTags[0].get('style').split("background:url('")[1].split("')no-repeat center")[0].strip()
|
407 |
productImgUrl= allproductImageTags[0].get('style').split("background:url('")[1].split("')no-repeat center")[0].strip()
|
| Line 507... |
Line 482... |
| 507 |
if allproductImageTags is not None and len(allproductImageTags)>0:
|
482 |
if allproductImageTags is not None and len(allproductImageTags)>0:
|
| 508 |
productImgUrl= allproductImageTags[0].get('style').split("background:url('")[1].split("')no-repeat center")[0].strip()
|
483 |
productImgUrl= allproductImageTags[0].get('style').split("background:url('")[1].split("')no-repeat center")[0].strip()
|
| 509 |
productDetailsSubMap['productCode']=productCode
|
484 |
productDetailsSubMap['productCode']=productCode
|
| 510 |
productDetailsSubMap['imgUrl']=productImgUrl
|
485 |
productDetailsSubMap['imgUrl']=productImgUrl
|
| 511 |
'''
|
486 |
'''
|
| 512 |
br1 = getBrowserObject()
|
- |
|
| 513 |
orderTrackingPage = br1.open(BASE_URL+subOrderTrackingParsingUrl)
|
487 |
orderTrackingPage = fetchResponseUsingProxy(BASE_URL+subOrderTrackingParsingUrl)
|
| 514 |
headers = str(orderTrackingPage.info()).split('\n')
|
- |
|
| 515 |
orderTrackingPage= ungzipResponse(orderTrackingPage)
|
- |
|
| 516 |
jsonResponse = None
|
- |
|
| 517 |
for header in headers:
|
- |
|
| 518 |
header = header.split(':')
|
- |
|
| 519 |
if header[0] == 'Content-Type' and 'json' in header[1]:
|
- |
|
| 520 |
jsonResponse = json.loads(orderTrackingPage)
|
- |
|
| 521 |
|
- |
|
| 522 |
orderTrackingPageSoup = None
|
- |
|
| 523 |
if jsonResponse is not None:
|
- |
|
| 524 |
orderTrackingPageSoup = BeautifulSoup(str(jsonResponse['text']))
|
- |
|
| 525 |
else:
|
- |
|
| 526 |
orderTrackingPageSoup = BeautifulSoup(orderTrackingPage)
|
488 |
orderTrackingPageSoup = BeautifulSoup(orderTrackingPage)
|
| 527 |
subOrdersDetails = self.parseSingleSubOrder(orderTrackingPageSoup, emailId, subOrderId)
|
489 |
subOrdersDetails = self.parseSingleSubOrder(orderTrackingPageSoup, emailId, subOrderId)
|
| 528 |
subOrders = list(set(subOrders + subOrdersDetails))
|
490 |
subOrders = list(set(subOrders + subOrdersDetails))
|
| 529 |
|
491 |
|
| 530 |
return subOrders
|
492 |
return subOrders
|
| 531 |
|
493 |
|