| Line 92... |
Line 92... |
| 92 |
|
92 |
|
| 93 |
|
93 |
|
| 94 |
def syncAsin():
|
94 |
def syncAsin():
|
| 95 |
notListedOnAmazon = []
|
95 |
notListedOnAmazon = []
|
| 96 |
diffAsins = []
|
96 |
diffAsins = []
|
| 97 |
login_url = "https://sellercentral.amazon.in/gp/homepage.html"
|
97 |
# login_url = "https://sellercentral.amazon.in/gp/homepage.html"
|
| 98 |
br = SellerCentralInventoryReport.login(login_url)
|
98 |
# br = SellerCentralInventoryReport.login(login_url)
|
| 99 |
report_url = "https://sellercentral.amazon.in/gp/upload-download-utils/requestReport.html?type=OpenListingReport&marketplaceID=44571&Request+Report="
|
99 |
# report_url = "https://sellercentral.amazon.in/gp/upload-download-utils/requestReport.html?type=OpenListingReport&marketplaceID=44571&Request+Report="
|
| 100 |
br = SellerCentralInventoryReport.requestReport(br,report_url)
|
100 |
# br = SellerCentralInventoryReport.requestReport(br,report_url)
|
| 101 |
status_url="https://sellercentral.amazon.in/gp/upload-download-utils/reportStatusData.html"
|
101 |
# status_url="https://sellercentral.amazon.in/gp/upload-download-utils/reportStatusData.html"
|
| 102 |
br, page = SellerCentralInventoryReport.checkStatus(br,status_url)
|
102 |
# br, page = SellerCentralInventoryReport.checkStatus(br,status_url)
|
| 103 |
br, batchId = SellerCentralInventoryReport.getReportBatchId(br,page)
|
103 |
# br, batchId = SellerCentralInventoryReport.getReportBatchId(br,page)
|
| 104 |
print "*********************************"
|
104 |
# print "*********************************"
|
| 105 |
print "Batch Id for request is ",batchId
|
105 |
# print "Batch Id for request is ",batchId
|
| 106 |
print "*********************************"
|
106 |
# print "*********************************"
|
| 107 |
ready = False
|
107 |
# ready = False
|
| 108 |
retryCount = 0
|
108 |
# retryCount = 0
|
| 109 |
while not ready:
|
109 |
# while not ready:
|
| 110 |
if retryCount == 10:
|
110 |
# if retryCount == 10:
|
| 111 |
print "File not available for download after multiple retries"
|
111 |
# print "File not available for download after multiple retries"
|
| 112 |
sys.exit(1)
|
112 |
# sys.exit(1)
|
| 113 |
br, download_link = SellerCentralInventoryReport.downloadReport(br,batchId,status_url)
|
113 |
# br, download_link = SellerCentralInventoryReport.downloadReport(br,batchId,status_url)
|
| 114 |
if download_link is not None:
|
114 |
# if download_link is not None:
|
| 115 |
ready= True
|
115 |
# ready= True
|
| 116 |
continue
|
116 |
# continue
|
| 117 |
print "File not ready for download yet.Will try again after 30 seconds."
|
117 |
# print "File not ready for download yet.Will try again after 30 seconds."
|
| 118 |
retryCount+=1
|
118 |
# retryCount+=1
|
| 119 |
time.sleep(30)
|
119 |
# time.sleep(30)
|
| 120 |
fPath = SellerCentralInventoryReport.fetchFile(download_link['href'],br,batchId)
|
120 |
# fPath = SellerCentralInventoryReport.fetchFile(download_link['href'],br,batchId)
|
| - |
|
121 |
fPath = '/tmp/9921129430.txt'
|
| 121 |
global amazonAsinPrice
|
122 |
global amazonAsinPrice
|
| 122 |
for line in open(fPath):
|
123 |
for line in open(fPath):
|
| 123 |
l = line.split('\t')
|
124 |
l = line.split('\t')
|
| 124 |
if (str(l[0]).startswith('FBA') or str(l[0]).startswith('FBB')):
|
125 |
if (str(l[0]).startswith('FBA') or str(l[0]).startswith('FBB')):
|
| 125 |
obj = __AmazonAsinPrice(l[1],l[2])
|
126 |
obj = __AmazonAsinPrice(l[1],l[2])
|