|
@@ -87,7 +87,6 @@ class SpApiRequest:
|
|
|
def decompression(self,reportId):
|
|
|
report = Reports(credentials=self.credentials, marketplace=self.marketplace)
|
|
|
while True:
|
|
|
- time.sleep(15)
|
|
|
reportId_info = report.get_report(reportId=reportId)
|
|
|
# print(reportId_info.payload)
|
|
|
print("please wait...")
|
|
@@ -101,11 +100,10 @@ class SpApiRequest:
|
|
|
else:
|
|
|
df = pd.read_table(rp_table.payload.get("url"),encoding='iso-8859-1')
|
|
|
return df
|
|
|
- else:
|
|
|
- if reportId_info.payload.get("processingStatus") in [ProcessingStatus.CANCELLED,ProcessingStatus.FATAL]:
|
|
|
- print("取消或失败")
|
|
|
- break
|
|
|
-
|
|
|
+ elif reportId_info.payload.get("processingStatus") in [ProcessingStatus.CANCELLED,ProcessingStatus.FATAL]:
|
|
|
+ print("取消或失败")
|
|
|
+ break
|
|
|
+ time.sleep(15)
|
|
|
print("please wait...")
|
|
|
|
|
|
def data_deal(self,decom_df):
|
|
@@ -225,7 +223,7 @@ class SpApiRequest:
|
|
|
if "purchase-order-number" in decom_df.columns:
|
|
|
decom_df['purchase-order-number'] = decom_df['purchase-order-number'].astype("string")
|
|
|
decom_df.fillna('',inplace=True)
|
|
|
- # decom_df["ReportDate"] = parse(shopReportday)
|
|
|
+ decom_df["ReportDate"] = parse(shopReportday)
|
|
|
decom_df['timezone'] = self.timezone
|
|
|
list_df = decom_df.to_numpy().tolist()
|
|
|
print(list_df[0])
|
|
@@ -415,7 +413,7 @@ if __name__ == '__main__':
|
|
|
'role_arn': 'arn:aws:iam::070880041373:role/Amazon_SP_API_ROLE'
|
|
|
}
|
|
|
sp_ = SpApiRequest(aws_credentials,Marketplaces.US,'3006125408623189')
|
|
|
- sp_.GET_MERCHANT_LISTINGS_ALL_DATA()
|
|
|
+ sp_.GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL()
|
|
|
"""
|
|
|
create database amz_sp_api;
|
|
|
"""
|