|  | @@ -32,6 +32,7 @@ class SpApiRequest:
 | 
											
												
													
														|  |          database="amz_sp_api",
 |  |          database="amz_sp_api",
 | 
											
												
													
														|  |          port=3306)
 |  |          port=3306)
 | 
											
												
													
														|  |          return conn
 |  |          return conn
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      def timeToLocalTime(self,para_time=None):
 |  |      def timeToLocalTime(self,para_time=None):
 | 
											
												
													
														|  |          if para_time is not None:
 |  |          if para_time is not None:
 | 
											
												
													
														|  |              if ":" not in para_time:
 |  |              if ":" not in para_time:
 | 
											
										
											
												
													
														|  | @@ -107,32 +108,6 @@ class SpApiRequest:
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              print("please wait...")
 |  |              print("please wait...")
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    def test_(self):
 |  | 
 | 
											
												
													
														|  | -        conn = self.mysql_connect()
 |  | 
 | 
											
												
													
														|  | -        cursor = conn.cursor()
 |  | 
 | 
											
												
													
														|  | -        sql = "select * from amz_sp_api.productInfo"
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        # query_rel = conn.query(sql)
 |  | 
 | 
											
												
													
														|  | -        # cursor.execute(sql)
 |  | 
 | 
											
												
													
														|  | -        # col = [i[0] for i in cursor.description]
 |  | 
 | 
											
												
													
														|  | -        # rel = cursor.fetchall()
 |  | 
 | 
											
												
													
														|  | -        # print(col)
 |  | 
 | 
											
												
													
														|  | -        # print(rel)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        sql1 = "select * from amz_sp_api.orderReport where `promotion-ids` in ['', Null]"
 |  | 
 | 
											
												
													
														|  | -        query_rel1 = conn.query(sql1)
 |  | 
 | 
											
												
													
														|  | -        cursor.execute(sql1)
 |  | 
 | 
											
												
													
														|  | -        col = [i[0] for i in cursor.description]
 |  | 
 | 
											
												
													
														|  | -        rel1 = cursor.fetchall()
 |  | 
 | 
											
												
													
														|  | -        df = pd.DataFrame(rel1,columns=col)
 |  | 
 | 
											
												
													
														|  | -        df['ReportDate'] = df['ReportDate'].astype("datetime64[ns]")
 |  | 
 | 
											
												
													
														|  | -        print(df.info())
 |  | 
 | 
											
												
													
														|  | -        # print(df)
 |  | 
 | 
											
												
													
														|  | -        bondary_date = (datetime.today() + timedelta(days=7))
 |  | 
 | 
											
												
													
														|  | -        list_ = ['',None]
 |  | 
 | 
											
												
													
														|  | -        df1 = df.query("ReportDate>@bondary_date or `promotion-ids` in @list_")
 |  | 
 | 
											
												
													
														|  | -        print(df1)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |      def data_deal(self,decom_df):
 |  |      def data_deal(self,decom_df):
 | 
											
												
													
														|  |          decom_df['mainImageUrl'] = decom_df['seller-sku'].map(lambda x: self.get_mainImage_url(x))
 |  |          decom_df['mainImageUrl'] = decom_df['seller-sku'].map(lambda x: self.get_mainImage_url(x))
 | 
											
												
													
														|  |          url_columns = [i for i in decom_df.columns if "url" in i.lower()]
 |  |          url_columns = [i for i in decom_df.columns if "url" in i.lower()]
 | 
											
										
											
												
													
														|  | @@ -285,8 +260,7 @@ class SpApiRequest:
 | 
											
												
													
														|  |      def load_order_items(self,**kwargs):
 |  |      def load_order_items(self,**kwargs):
 | 
											
												
													
														|  |          return Orders(credentials=self.credentials).get_order_items(**kwargs)
 |  |          return Orders(credentials=self.credentials).get_order_items(**kwargs)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -    def insert_(self, sleep_time=0.8):
 |  | 
 | 
											
												
													
														|  | 
 |  | +    def order_instant(self, sleep_time=0.8):
 | 
											
												
													
														|  |          insert_list_orderBasic = []
 |  |          insert_list_orderBasic = []
 | 
											
												
													
														|  |          insert_list_orderDetail = []
 |  |          insert_list_orderDetail = []
 | 
											
												
													
														|  |          orderId_list = []
 |  |          orderId_list = []
 | 
											
										
											
												
													
														|  | @@ -441,13 +415,10 @@ if __name__ == '__main__':
 | 
											
												
													
														|  |          'role_arn': 'arn:aws:iam::070880041373:role/Amazon_SP_API_ROLE'
 |  |          'role_arn': 'arn:aws:iam::070880041373:role/Amazon_SP_API_ROLE'
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      sp_ = SpApiRequest(aws_credentials,Marketplaces.US,'3006125408623189')
 |  |      sp_ = SpApiRequest(aws_credentials,Marketplaces.US,'3006125408623189')
 | 
											
												
													
														|  | -    # sp_.GET_MERCHANT_LISTINGS_ALL_DATA()
 |  | 
 | 
											
												
													
														|  |      sp_.GET_MERCHANT_LISTINGS_ALL_DATA()
 |  |      sp_.GET_MERCHANT_LISTINGS_ALL_DATA()
 | 
											
												
													
														|  | -    # sp_.mysql_connect().commit()
 |  | 
 | 
											
												
													
														|  | -    # sp_.decompression("1532408019678")
 |  | 
 | 
											
												
													
														|  | -    # sp_.GET_MERCHANT_LISTINGS_ALL_DATA()
 |  | 
 | 
											
												
													
														|  | -    # sp_.timeToLocalTime()
 |  | 
 | 
											
												
													
														|  | -    # print(type(sp_))
 |  | 
 | 
											
												
													
														|  | 
 |  | +    """
 | 
											
												
													
														|  | 
 |  | +    create database amz_sp_api;
 | 
											
												
													
														|  | 
 |  | +    """
 | 
											
												
													
														|  |      """
 |  |      """
 | 
											
												
													
														|  |              create table amz_sp_api.productInfo
 |  |              create table amz_sp_api.productInfo
 | 
											
												
													
														|  |              (
 |  |              (
 | 
											
										
											
												
													
														|  | @@ -481,7 +452,6 @@ if __name__ == '__main__':
 | 
											
												
													
														|  |              `timezone`	VARCHAR(30)
 |  |              `timezone`	VARCHAR(30)
 | 
											
												
													
														|  |              )
 |  |              )
 | 
											
												
													
														|  |      """
 |  |      """
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |      """
 |  |      """
 | 
											
												
													
														|  |      create table amz_sp_api.orderReport
 |  |      create table amz_sp_api.orderReport
 | 
											
												
													
														|  |      (`amazon-order-id` VARCHAR(40),
 |  |      (`amazon-order-id` VARCHAR(40),
 |