|
@@ -161,9 +161,24 @@ class SpApiRequest:
|
|
print(df.columns)
|
|
print(df.columns)
|
|
return df
|
|
return df
|
|
elif rp_table.payload.get('compressionAlgorithm') is None and self.marketplace.marketplace_id in ['A1VC38T7YXB528']:
|
|
elif rp_table.payload.get('compressionAlgorithm') is None and self.marketplace.marketplace_id in ['A1VC38T7YXB528']:
|
|
- df = pd.read_table(rp_table.payload.get("url"),encoding='Shift-JIS')
|
|
|
|
- print(df.columns)
|
|
|
|
- return df
|
|
|
|
|
|
+ try:
|
|
|
|
+ df = pd.read_table(rp_table.payload.get("url"),encoding='Shift-JIS')
|
|
|
|
+ print(df.columns)
|
|
|
|
+ return df
|
|
|
|
+ except:
|
|
|
|
+ print("==========!!!!!!!!")
|
|
|
|
+ try:
|
|
|
|
+ df = pd.read_table(rp_table.payload.get("url"),encoding='iso-8859-1')
|
|
|
|
+ print(df.columns)
|
|
|
|
+ return df
|
|
|
|
+ except:
|
|
|
|
+ print("!!!!!!!!!!!!!!!!!==========")
|
|
|
|
+ try:
|
|
|
|
+ df = pd.read_table(rp_table.payload.get("url"),encoding='utf-8')
|
|
|
|
+ return df
|
|
|
|
+ except:
|
|
|
|
+ print("失败")
|
|
|
|
+ return pd.DataFrame()
|
|
elif reportId_info.payload.get("processingStatus") in [ProcessingStatus.CANCELLED,ProcessingStatus.FATAL]:
|
|
elif reportId_info.payload.get("processingStatus") in [ProcessingStatus.CANCELLED,ProcessingStatus.FATAL]:
|
|
try:
|
|
try:
|
|
print(reportId_info)
|
|
print(reportId_info)
|
|
@@ -881,6 +896,8 @@ class SpApiRequest:
|
|
# decom_df['timezone'] = decom_df["purchase-date"].map(lambda x: parse(x).tzname()).fillna(method='bfill')
|
|
# decom_df['timezone'] = decom_df["purchase-date"].map(lambda x: parse(x).tzname()).fillna(method='bfill')
|
|
decom_df['timezone'] = "UTC"
|
|
decom_df['timezone'] = "UTC"
|
|
print("==========================================================")
|
|
print("==========================================================")
|
|
|
|
+ if len(decom_df)==0:
|
|
|
|
+ return ""
|
|
decom_df[["purchase-date", "last-updated-date"]] = decom_df[["purchase-date", "last-updated-date"]].applymap(
|
|
decom_df[["purchase-date", "last-updated-date"]] = decom_df[["purchase-date", "last-updated-date"]].applymap(
|
|
lambda x: self.timeDeal(x) if pd.isna(x) == False or x != None else x)
|
|
lambda x: self.timeDeal(x) if pd.isna(x) == False or x != None else x)
|
|
if 'is-business-order' not in decom_df.columns:
|
|
if 'is-business-order' not in decom_df.columns:
|
|
@@ -1522,10 +1539,12 @@ class SpApiRequest:
|
|
@classmethod
|
|
@classmethod
|
|
def get_allShops(cls,data_type=Literal["GET_FLAT_FILE_OPEN_LISTINGS_DATA","GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL"],days=-1,**kwargs): # Main-AllCountries-AuthAndPost, 所有店铺数据报告获取的主要函数
|
|
def get_allShops(cls,data_type=Literal["GET_FLAT_FILE_OPEN_LISTINGS_DATA","GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL"],days=-1,**kwargs): # Main-AllCountries-AuthAndPost, 所有店铺数据报告获取的主要函数
|
|
df = cls.auth_info()
|
|
df = cls.auth_info()
|
|
- # zosi = df.query("account_name=='AM-ZOSI-US'")['refresh_token'].to_numpy().tolist()
|
|
|
|
- zosi = df.query("account_name=='ANLAPUS_US'")['refresh_token'].to_numpy().tolist()
|
|
|
|
|
|
+ zosi = df.query("account_name=='AM-ZOSI-US'")['refresh_token'].to_numpy().tolist()
|
|
|
|
+ # zosi = df.query("account_name==' ANX防犯工房'")['refresh_token'].to_numpy().tolist()
|
|
# print(zosi)
|
|
# print(zosi)
|
|
refreshtoken_list = df.query("account_name!='AM-ZOSI-US'")['refresh_token'].to_numpy().tolist()
|
|
refreshtoken_list = df.query("account_name!='AM-ZOSI-US'")['refresh_token'].to_numpy().tolist()
|
|
|
|
+ # refreshtoken_list = []
|
|
|
|
+
|
|
zosi.extend(refreshtoken_list)
|
|
zosi.extend(refreshtoken_list)
|
|
refreshtoken_list = zosi.copy()
|
|
refreshtoken_list = zosi.copy()
|
|
print(len(refreshtoken_list))
|
|
print(len(refreshtoken_list))
|
|
@@ -1593,7 +1612,7 @@ class SpApiRequest:
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
# for days in range(-17,-2):
|
|
# for days in range(-17,-2):
|
|
# SpApiRequest.get_allShops("GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE",days=days,**{})
|
|
# SpApiRequest.get_allShops("GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE",days=days,**{})
|
|
- for days in range(-60,-2):
|
|
|
|
|
|
+ for days in range(-5,-2):
|
|
SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=days,**{})
|
|
SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=days,**{})
|
|
#
|
|
#
|
|
# SpApiRequest.listing_infoTable()
|
|
# SpApiRequest.listing_infoTable()
|