Subversion Repositories SmartDukaan

Rev

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

Rev 12414 Rev 12415
Line 205... Line 205...
205
        return fbaSaleSnapshot.totalSale
205
        return fbaSaleSnapshot.totalSale
206
            
206
            
207
def syncAsin():
207
def syncAsin():
208
#    notListedOnAmazon = []
208
#    notListedOnAmazon = []
209
#    diffAsins = []
209
#    diffAsins = []
210
    login_url = "https://sellercentral.amazon.in/gp/homepage.html"
210
#    login_url = "https://sellercentral.amazon.in/gp/homepage.html"
211
    br = SellerCentralInventoryReport.login(login_url)
211
#    br = SellerCentralInventoryReport.login(login_url)
212
    report_url = "https://sellercentral.amazon.in/gp/upload-download-utils/requestReport.html?type=OpenListingReport&marketplaceID=44571&Request+Report="
212
#    report_url = "https://sellercentral.amazon.in/gp/upload-download-utils/requestReport.html?type=OpenListingReport&marketplaceID=44571&Request+Report="
213
    br = SellerCentralInventoryReport.requestReport(br,report_url)
213
#    br = SellerCentralInventoryReport.requestReport(br,report_url)
214
    status_url="https://sellercentral.amazon.in/gp/upload-download-utils/reportStatusData.html"
214
#    status_url="https://sellercentral.amazon.in/gp/upload-download-utils/reportStatusData.html"
215
    br, page = SellerCentralInventoryReport.checkStatus(br,status_url)
215
#    br, page = SellerCentralInventoryReport.checkStatus(br,status_url)
216
    br, batchId = SellerCentralInventoryReport.getReportBatchId(br,page)
216
#    br, batchId = SellerCentralInventoryReport.getReportBatchId(br,page)
217
    print "*********************************"
217
#    print "*********************************"
218
    print "Batch Id for request is ",batchId
218
#    print "Batch Id for request is ",batchId
219
    print "*********************************"
219
#    print "*********************************"
220
    ready = False
220
#    ready = False
221
    retryCount = 0
221
#    retryCount = 0
222
    while not ready:
222
#    while not ready:
223
        if retryCount == 10:
223
#        if retryCount == 10:
224
            print "File not available for download after multiple retries"
224
#            print "File not available for download after multiple retries"
225
            sys.exit(1)
225
#            sys.exit(1)
226
        br, download_link = SellerCentralInventoryReport.downloadReport(br,batchId,status_url)
226
#        br, download_link = SellerCentralInventoryReport.downloadReport(br,batchId,status_url)
227
        if download_link is not None:
227
#        if download_link is not None:
228
            ready= True
228
#            ready= True
229
            continue
229
#            continue
230
        print "File not ready for download yet.Will try again after 30 seconds."
230
#        print "File not ready for download yet.Will try again after 30 seconds."
231
        retryCount+=1
231
#        retryCount+=1
232
        time.sleep(30)
232
#        time.sleep(30)
233
    fPath = SellerCentralInventoryReport.fetchFile(download_link['href'],br,batchId)
233
#    fPath = SellerCentralInventoryReport.fetchFile(download_link['href'],br,batchId)
-
 
234
    fPath = "/tmp/9940651090.txt"
234
    global amazonAsinPrice
235
    global amazonAsinPrice
235
    for line in open(fPath):
236
    for line in open(fPath):
236
        l = line.split('\t')
237
        l = line.split('\t')
237
        if (str(l[0]).startswith('FBA') or str(l[0]).startswith('FBB')):
238
        if (str(l[0]).startswith('FBA') or str(l[0]).startswith('FBB')):
238
            obj = __AmazonAsinPrice(l[1],l[2])
239
            obj = __AmazonAsinPrice(l[1],l[2])
Line 506... Line 507...
506
        amDetails = __AmazonDetails(sku, ourSp, ourRank, lowestSellerName,lowestSellerSp,secondLowestSellerName, secondLowestSellerSp, thirdLowestSellerName, thirdLowestSellerSp,len(scrapInfo),multipleListings)
507
        amDetails = __AmazonDetails(sku, ourSp, ourRank, lowestSellerName,lowestSellerSp,secondLowestSellerName, secondLowestSellerSp, thirdLowestSellerName, thirdLowestSellerSp,len(scrapInfo),multipleListings)
507
        print "am details obj created"
508
        print "am details obj created"
508
        try:
509
        try:
509
            print "inside val getter"
510
            print "inside val getter"
510
            val.vatRate = catalog_client.getVatPercentageForItem(int(val.sku[3:]), val.state_id, amDetails.ourSp)
511
            val.vatRate = catalog_client.getVatPercentageForItem(int(val.sku[3:]), val.state_id, amDetails.ourSp)
-
 
512
            print catalog_client
511
            print "vat fetched"
513
            print "vat fetched"
512
        except:
514
        except:
513
            print "vat exception"
515
            print "vat exception"
514
            temp = []
516
            temp = []
515
            temp.append(val)
517
            temp.append(val)