Skip to content

Commit 9f82e85

Browse files
committed
Changed private attributes
1 parent f3206f5 commit 9f82e85

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

amazon_paapi/api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ def __init__(
4040
):
4141
self._key = key
4242
self._secret = secret
43-
self._tag = tag
44-
self._country = country
45-
self._throttling = float(throttling)
4643
self._last_query_time = time.time() - throttling
44+
self.tag = tag
45+
self.country = country
46+
self.throttling = float(throttling)
4747

4848
try:
4949
self._host = "webservices.amazon." + models.regions.DOMAINS[country]
50-
self._region = models.regions.REGIONS[country]
51-
self._marketplace = "www.amazon." + models.regions.DOMAINS[country]
50+
self.region = models.regions.REGIONS[country]
51+
self.marketplace = "www.amazon." + models.regions.DOMAINS[country]
5252
except KeyError as error:
5353
raise InvalidArgumentException("Country code is not correct") from error
5454

55-
self._api = DefaultApi(key, secret, self._host, self._region)
55+
self._api = DefaultApi(key, secret, self._host, self.region)
5656

5757
def get_items(
5858
self,
@@ -329,7 +329,7 @@ def get_browse_nodes(
329329
return requests.get_browse_nodes_response(self, request)
330330

331331
def _throttle(self):
332-
wait_time = self._throttling - (time.time() - self._last_query_time)
332+
wait_time = self.throttling - (time.time() - self._last_query_time)
333333
if wait_time > 0:
334334
time.sleep(wait_time)
335335
self._last_query_time = time.time()

amazon_paapi/helpers/requests.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def get_items_request(amazon_api, asin_chunk: List[str], **kwargs) -> GetItemsRe
3333
return GetItemsRequest(
3434
resources=_get_request_resources(GetItemsResource),
3535
partner_type=PartnerType.ASSOCIATES,
36-
marketplace=amazon_api._marketplace,
37-
partner_tag=amazon_api._tag,
36+
marketplace=amazon_api.marketplace,
37+
partner_tag=amazon_api.tag,
3838
item_ids=asin_chunk,
3939
**kwargs
4040
)
@@ -61,8 +61,8 @@ def get_search_items_request(amazon_api, **kwargs) -> SearchItemsRequest:
6161
return SearchItemsRequest(
6262
resources=_get_request_resources(SearchItemsResource),
6363
partner_type=PartnerType.ASSOCIATES,
64-
marketplace=amazon_api._marketplace,
65-
partner_tag=amazon_api._tag,
64+
marketplace=amazon_api.marketplace,
65+
partner_tag=amazon_api.tag,
6666
**kwargs
6767
)
6868
except TypeError as e:
@@ -88,8 +88,8 @@ def get_variations_request(amazon_api, **kwargs) -> GetVariationsRequest:
8888
return GetVariationsRequest(
8989
resources=_get_request_resources(GetVariationsResource),
9090
partner_type=PartnerType.ASSOCIATES,
91-
marketplace=amazon_api._marketplace,
92-
partner_tag=amazon_api._tag,
91+
marketplace=amazon_api.marketplace,
92+
partner_tag=amazon_api.tag,
9393
**kwargs
9494
)
9595
except TypeError as e:
@@ -117,8 +117,8 @@ def get_browse_nodes_request(amazon_api, **kwargs) -> GetBrowseNodesRequest:
117117
return GetBrowseNodesRequest(
118118
resources=_get_request_resources(GetBrowseNodesResource),
119119
partner_type=PartnerType.ASSOCIATES,
120-
marketplace=amazon_api._marketplace,
121-
partner_tag=amazon_api._tag,
120+
marketplace=amazon_api.marketplace,
121+
partner_tag=amazon_api.tag,
122122
**kwargs
123123
)
124124
except TypeError as e:
@@ -142,7 +142,7 @@ def get_browse_nodes_response(
142142

143143

144144
def _get_request_resources(resources) -> List[str]:
145-
resources = inspect.getmembers(resources, lambda a: not (inspect.isroutine(a)))
145+
resources = inspect.getmembers(resources, lambda a: not inspect.isroutine(a))
146146
resources = [
147147
x[-1] for x in resources if isinstance(x[-1], str) and x[0][0:2] != "__"
148148
]

0 commit comments

Comments
 (0)