Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions aliexpress_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand All @@ -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')

Expand All @@ -92,13 +95,16 @@ 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.

Args:
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.
Expand All @@ -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')

Expand All @@ -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.

Expand All @@ -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.
Expand All @@ -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')

Expand All @@ -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.

Expand All @@ -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.
Expand All @@ -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')

Expand Down