diff --git a/aliexpress_api/api.py b/aliexpress_api/api.py index f4e84cb..1d192d7 100644 --- a/aliexpress_api/api.py +++ b/aliexpress_api/api.py @@ -50,6 +50,7 @@ def get_products_details(self, product_ids: Union[str, List[str]], fields: Union[str, List[str]] = None, country: str = None, + tracking_id: str = None, **kwargs) -> List[models.Product]: """Get products information. @@ -58,6 +59,8 @@ def get_products_details(self, fields (``str | list[str]``): The fields to include in the results. Defaults to all. country (``str``): Filter products that can be sent to that country. Returns the price according to the country's tax rate policy. + tracking_id (``str``): The tracking id for link generator. Defaults to the one passed + to constructor. Returns: ``list[models.Product]``: A list of products. @@ -78,7 +81,7 @@ def get_products_details(self, request.country = country request.target_currency = self._currency request.target_language = self._language - request.tracking_id = self._tracking_id + request.tracking_id = tracking_id or self._tracking_id response = api_request(request, 'aliexpress_affiliate_productdetail_get_response') @@ -92,6 +95,7 @@ def get_products_details(self, def get_affiliate_links(self, links: Union[str, List[str]], link_type: models.LinkType = models.LinkType.NORMAL, + tracking_id: str = None, **kwargs) -> List[models.AffiliateLink]: """Converts a list of links in affiliate links. @@ -99,6 +103,8 @@ def get_affiliate_links(self, links (``str | list[str]``): One or more links to convert. link_type (``models.LinkType``): Choose between normal link with standard commission or hot link with hot product commission. Defaults to NORMAL. + tracking_id (``str``): The tracking id for link generator. Defaults to the one passed + to constructor. Returns: ``list[models.AffiliateLink]``: A list containing the affiliate links. @@ -119,7 +125,7 @@ def get_affiliate_links(self, request.app_signature = self._app_signature request.source_values = links request.promotion_link_type = link_type - request.tracking_id = self._tracking_id + request.tracking_id = tracking_id or self._tracking_id response = api_request(request, 'aliexpress_affiliate_link_generate_response') @@ -132,15 +138,16 @@ def get_affiliate_links(self, def get_hotproducts(self, category_ids: Union[str, List[str]] = None, delivery_days: int = None, - fields: Union[str, List[str]] = None, - keywords: str = None, - max_sale_price: int = None, - min_sale_price: int = None, - page_no: int = None, - page_size: int = None, - platform_product_type: models.ProductType = None, - ship_to_country: str = None, - sort: models.SortBy = None, + fields: Union[str, List[str]] = None, + keywords: str = None, + max_sale_price: int = None, + min_sale_price: int = None, + page_no: int = None, + page_size: int = None, + platform_product_type: models.ProductType = None, + ship_to_country: str = None, + sort: models.SortBy = None, + tracking_id: str = None, **kwargs) -> models.HotProductsResponse: """Search for affiliated products with high commission. @@ -159,6 +166,8 @@ def get_hotproducts(self, ship_to_country (``str``): Filter products that can be sent to that country. Returns the price according to the country's tax rate policy. sort (``models.SortBy``): Specifies the sort method. + tracking_id (``str``): The tracking id for link generator. Defaults to the one passed + to constructor. Returns: ``models.HotProductsResponse``: Contains response information and the list of products. @@ -183,7 +192,7 @@ def get_hotproducts(self, request.sort = sort request.target_currency = self._currency request.target_language = self._language - request.tracking_id = self._tracking_id + request.tracking_id = tracking_id or self._tracking_id response = api_request(request, 'aliexpress_affiliate_hotproduct_query_response') @@ -197,15 +206,16 @@ def get_hotproducts(self, def get_products(self, category_ids: Union[str, List[str]] = None, delivery_days: int = None, - fields: Union[str, List[str]] = None, - keywords: str = None, - max_sale_price: int = None, - min_sale_price: int = None, - page_no: int = None, - page_size: int = None, - platform_product_type: models.ProductType = None, - ship_to_country: str = None, - sort: models.SortBy = None, + fields: Union[str, List[str]] = None, + keywords: str = None, + max_sale_price: int = None, + min_sale_price: int = None, + page_no: int = None, + page_size: int = None, + platform_product_type: models.ProductType = None, + ship_to_country: str = None, + sort: models.SortBy = None, + tracking_id: str = None, **kwargs) -> models.ProductsResponse: """Search for affiliated products. @@ -224,6 +234,8 @@ def get_products(self, ship_to_country (``str``): Filter products that can be sent to that country. Returns the price according to the country's tax rate policy. sort (``models.SortBy``): Specifies the sort method. + tracking_id (``str``): The tracking id for link generator. Defaults to the one passed + to constructor. Returns: ``models.ProductsResponse``: Contains response information and the list of products. @@ -248,7 +260,7 @@ def get_products(self, request.sort = sort request.target_currency = self._currency request.target_language = self._language - request.tracking_id = self._tracking_id + request.tracking_id = tracking_id or self._tracking_id response = api_request(request, 'aliexpress_affiliate_product_query_response')