@@ -696,7 +696,7 @@ class SpApiRequest:
time.sleep(5)
conn = self.mysql_connect_auth_lst()
cursor = conn.cursor()
- query_judge = f"""select count(*) from asj_ads.orderReport where ReportDate='{shopReportday}' and country_code='{countryCode}'"""
+ query_judge = f"""select count(*) from asj_ads.orderReport_ where ReportDate='{shopReportday}' and country_code='{countryCode}'"""
print(query_judge)
cursor.execute(query_judge)
rel = cursor.fetchall()
@@ -761,7 +761,16 @@ class SpApiRequest:
# print(list(conn.query("select * from amz_sp_api.orderReport")))
sql = f"""
- insert into asj_ads.orderReport
+ insert into asj_ads.orderReport_(`amazon-order-id`, `merchant-order-id`, `purchase-date`, `last-updated-date`, `order-status`,
+ `fulfillment-channel`, `sales-channel`, `order-channel`, `ship-service-level`,
+ `product-name`,
+ `sku`, `asin`, `item-status`, `quantity`, `currency`, `item-price`, `item-tax`,
+ `shipping-price`,
+ `shipping-tax`, `gift-wrap-price`, `gift-wrap-tax`, `item-promotion-discount`,
+ `ship-promotion-discount`, `ship-city`, `ship-state`, `ship-postal-code`, `ship-country`,
+ `promotion-ids`, `is-business-order`, `purchase-order-number`, `price-designation`,
+ `ReportDate`,
+ `timezone`, `seller_id`, `country_code`,`insert_time`)
values (%s,%s,%s,%s,%s,%s,%s, %s,%s,%s,%s,%s,%s,%s, %s,%s,%s,%s,%s,%s,%s, %s,%s,%s,%s,%s,%s,%s, %s,%s,%s,%s,%s,%s,%s,%s)
""" # ok
try:
@@ -1083,8 +1092,8 @@ class SpApiRequest:
## sp_api.GET_FLAT_FILE_OPEN_LISTINGS_DATA(auth_conn, seller_id)
if __name__ == '__main__':
- for days in range(2,35):
- SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=-days,**{"level":"SKU"})
+ for days in range(35,45):
+ SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=-days,**{"level":"SKU"})
# SpApiRequest.listing_infoTable()
# rel = SpApiRequest.get_catelog(account_name='ANLAPUS_US',country=Marketplaces.US,asin='B0BVXB4KT9')
# print(rel)
@@ -8,6 +8,8 @@ def func_run():
except:
sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA")
print("="*40)
+ print("="*40)
sp_api_client.SpApiRequest.listing_infoTable()