Skip to content

Commit

Permalink
fix: Added browse_node_id to seach mandatory args
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioteula committed Jan 14, 2022
1 parent 527e3cb commit 83cec3e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode/
.DS_Store
secrets.py
test.py


# Byte-compiled / optimized / DLL files
Expand Down
8 changes: 3 additions & 5 deletions amazon_paapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
A simple Python wrapper for the last version of the Amazon Product Advertising API.
"""

from typing import List, Union
import time

from typing import List, Union

from . import models
from .sdk.api.default_api import DefaultApi
from .errors import InvalidArgumentException
from .helpers import arguments
from .helpers import requests
from .helpers import arguments, requests
from .helpers.generators import get_list_chunks
from .helpers.items import sort_items
from .sdk.api.default_api import DefaultApi


class AmazonApi:
Expand Down
10 changes: 6 additions & 4 deletions amazon_paapi/helpers/arguments.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Module with helper functions for managing arguments."""


from ..tools import get_asin
from ..errors import InvalidArgumentException, AsinNotFoundException
from typing import List, Union

from ..errors import AsinNotFoundException, InvalidArgumentException
from ..tools import get_asin


def get_items_ids(items: Union[str, List[str]]) -> List[str]:
if not isinstance(items, str) and not isinstance(items, List):
Expand All @@ -30,10 +31,11 @@ def check_search_args(**kwargs):

def _check_search_mandatory_args(**kwargs):
mandatory_args = [kwargs['keywords'], kwargs['actor'], kwargs['artist'],
kwargs['author'],kwargs['brand'], kwargs['title']]
kwargs['author'], kwargs['brand'], kwargs['title'],
kwargs['browse_node_id']]
if all(arg is None for arg in mandatory_args):
error_message = ('At least one of the following args should be provided: '
'keywords, actor, artist, author, brand or title.')
'keywords, actor, artist, author, brand, title or browse_node_id.')
raise InvalidArgumentException(error_message)


Expand Down

0 comments on commit 83cec3e

Please sign in to comment.