Subversion Repositories SmartDukaan

Rev

Rev 18038 | Rev 18060 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18038 Rev 18054
Line 390... Line 390...
390
                productUrl = supcElement.attr("data-href")
390
                productUrl = supcElement.attr("data-href")
391
                imgUrl = supcElement.find('img').attr('src')
391
                imgUrl = supcElement.find('img').attr('src')
392
                try:
392
                try:
393
                    supc = self.catalogdb.MasterData.find_one({"secondaryIdentifier":productUrl.split("/")[-1], "source_id":self.store_id})
393
                    supc = self.catalogdb.MasterData.find_one({"secondaryIdentifier":productUrl.split("/")[-1], "source_id":self.store_id})
394
                    if supc is None:
394
                    if supc is None:
395
                        raise 
395
                        raise
-
 
396
                    else:
-
 
397
                        supc = supc['identifier'] 
396
                except:
398
                except:
-
 
399
                    #try:
397
                    supc = imgUrl.split('-')[-3]
400
                    supc = imgUrl.split('-')[-3]
-
 
401
                    #except:
-
 
402
                        #Try to figure out supc using product url
-
 
403
                        
398
                supcMap[supc] = {'title':title, 'imgUrl':imgUrl, 'productUrl':productUrl}
404
                supcMap[supc] = {'title':title, 'imgUrl':imgUrl, 'productUrl':productUrl}
399
            except:
405
            except:
400
                pass
406
                pass
401
        return json.loads(jsonValue)
407
        return json.loads(jsonValue)
402
 
408
 
Line 911... Line 917...
911
 
917
 
912
 
918
 
913
def main():
919
def main():
914
    #print todict([1,2,"3"])
920
    #print todict([1,2,"3"])
915
    store = getStore(3)
921
    store = getStore(3)
916
    store.parseOrderRawHtml(332221, "3232311", 2, readSSh("/home/amit/sample1.html"), "    https://m.snapdeal.com/purchaseMobileComplete?code=a8b3420d4c5bc248ea887df6c9b3a724&order=10478372453")
922
    store.parseOrderRawHtml(332222, "3232311", 2, readSSh("/home/amit/sample1.html"), "    https://m.snapdeal.com/purchaseMobileComplete?code=a8b3420d4c5bc248ea887df6c9b3a724&order=10478372453")
917
    #store.scrapeAffiliate()
923
    #store.scrapeAffiliate()
918
    #https://m.snapdeal.com/purchaseMobileComplete?code=3fbc8a02a1c4d3c4e906f46886de0464&order=5808451506
924
    #https://m.snapdeal.com/purchaseMobileComplete?code=3fbc8a02a1c4d3c4e906f46886de0464&order=5808451506
919
    #https://m.snapdeal.com/purchaseMobileComplete?code=9f4dfa49ff08a16d04c5e4bf519506fc&order=9611672826
925
    #https://m.snapdeal.com/purchaseMobileComplete?code=9f4dfa49ff08a16d04c5e4bf519506fc&order=9611672826
920
    
926
    
921
#    orders = list(session.query(OrdersRaw).filter_by(store_id=3).filter_by(status='ORDER_NOT_CREATED').all())
927
#    orders = list(session.query(OrdersRaw).filter_by(store_id=3).filter_by(status='ORDER_NOT_CREATED').all())