Skip to content

Commit 11924fc

Browse files
committed
Updated api module for linters
1 parent 7606737 commit 11924fc

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

amazon_paapi/api.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
A simple Python wrapper for the last version of the Amazon Product Advertising API.
44
"""
55

6+
from typing import List, Union
7+
import time
68

79
from . import models
810
from .sdk.api.default_api import DefaultApi
@@ -11,9 +13,6 @@
1113
from .helpers import requests
1214
from .helpers.generators import get_list_chunks
1315

14-
from typing import List, Union
15-
import time
16-
1716

1817
class AmazonApi:
1918
"""Provides methods to get information from Amazon using your API credentials.
@@ -42,19 +41,21 @@ def __init__(self, key: str, secret: str, tag: str, country: models.Country, thr
4241
self._host = 'webservices.amazon.' + models.regions.DOMAINS[country]
4342
self._region = models.regions.REGIONS[country]
4443
self._marketplace = 'www.amazon.' + models.regions.DOMAINS[country]
45-
except KeyError:
46-
raise InvalidArgumentException('Country code is not correct')
44+
except KeyError as error:
45+
raise InvalidArgumentException('Country code is not correct') from error
4746

4847
self._api = DefaultApi(key, secret, self._host, self._region)
4948

5049

51-
def get_items(self,
50+
def get_items(
51+
self,
5252
items: Union[str, List[str]],
5353
condition: models.Condition = None,
5454
merchant: models.Merchant = None,
5555
currency_of_preference: str = None,
5656
languages_of_preference: List[str] = None,
57-
**kwargs) -> List[models.Item]:
57+
**kwargs
58+
) -> List[models.Item]:
5859

5960
"""Get items information from Amazon.
6061
@@ -86,7 +87,7 @@ def get_items(self,
8687
'merchant': merchant,
8788
'currency_of_preference': currency_of_preference,
8889
'languages_of_preference': languages_of_preference
89-
})
90+
})
9091

9192
items_ids = arguments.get_items_ids(items)
9293
results = []
@@ -100,7 +101,8 @@ def get_items(self,
100101
return results
101102

102103

103-
def search_items(self,
104+
def search_items(
105+
self,
104106
item_count: int = None,
105107
item_page: int = None,
106108
actor: str = None,
@@ -122,7 +124,8 @@ def search_items(self,
122124
min_reviews_rating: int = None,
123125
search_index: str = None,
124126
sort_by: models.SortBy = None,
125-
**kwargs) -> models.SearchResult:
127+
**kwargs
128+
) -> models.SearchResult:
126129
"""Searches for items on Amazon based on a search query. At least one of the following
127130
parameters should be specified: ``keywords``, ``actor``, ``artist``, ``author``,
128131
``brand`` or ``title``.
@@ -205,15 +208,17 @@ def search_items(self,
205208
return requests.get_search_items_response(self, request)
206209

207210

208-
def get_variations(self,
211+
def get_variations(
212+
self,
209213
asin: str,
210214
variation_count: int = None,
211215
variation_page: int = None,
212216
condition: models.Condition = None,
213217
currency_of_preference: str = None,
214218
languages_of_preference: List[str] = None,
215219
merchant: models.Merchant = None,
216-
**kwargs) -> models.VariationsResult:
220+
**kwargs
221+
) -> models.VariationsResult:
217222
"""Returns a set of items that are the same product, but differ according to a
218223
consistent theme, for example size and color. A variation is a child ASIN.
219224
@@ -260,10 +265,12 @@ def get_variations(self,
260265
return requests.get_variations_response(self, request)
261266

262267

263-
def get_browse_nodes(self,
268+
def get_browse_nodes(
269+
self,
264270
browse_node_ids: List[str],
265271
languages_of_preference: List[str] = None,
266-
**kwargs) -> List[models.BrowseNode]:
272+
**kwargs
273+
) -> List[models.BrowseNode]:
267274
"""Returns the specified browse node's information like name, children and ancestors.
268275
269276
Args:

0 commit comments

Comments
 (0)