Skip to content

Commit

Permalink
adding last combinations of searches + testing all urls
Browse files Browse the repository at this point in the history
  • Loading branch information
icepick4 committed Jan 28, 2023
1 parent 7bdd1ad commit 30995ae
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 110 deletions.
4 changes: 3 additions & 1 deletion onepyece/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
"chapter_by_title",
"count_chapters",
"arc_by_id",
"arc_by_title",
# "arc_by_title",
"arc_by_saga_id",
"count_arcs",
"saga_by_id",
"saga_by_title",
"count_sagas",
"haki_by_id",
"haki_by_name",
"haki_by_roman_name",
"haki_by_characters_id",
"count_hakis",
"character_by_id",
"character_by_name",
Expand Down
Binary file modified onepyece/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified onepyece/__pycache__/api.cpython-39.pyc
Binary file not shown.
Binary file modified onepyece/__pycache__/common.cpython-39.pyc
Binary file not shown.
Binary file modified onepyece/__pycache__/functions.cpython-39.pyc
Binary file not shown.
Binary file modified onepyece/__pycache__/interface.cpython-39.pyc
Binary file not shown.
16 changes: 8 additions & 8 deletions onepyece/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
"episodes": ["id", "count", "title", "saga_id", "arc_id"],
"movies": ["id", "count", "title"],
"tomes": ["id", "count", "title"],
"chapters": ["id", "count", "title"],
"arcs": ["id", "count", "title"],
"chapters": ["id", "count", "title", "tome_id", "tome"],
"arcs": ["id", "count", "saga_id"],
"sagas": ["id", "count", "title"],
"hakis": ["id", "count", "name", "roman_name"],
"hakis": ["id", "count", "name", "roman_name", "characters_id"],
"characters": ["id", "count", "name", "job", "bounty", "status", "size"],
"dials": ["id", "count", "name", "type"],
"luffy/gears": ["id", "count", "title"],
"luffy/techniques": ["id", "count", "name", "translation"],
"luffy/techniques": ["id", "count", "name", "translation", "gear_id"],
"locates": ["id", "count", "name", "sea", "affiliation"],
"fruits": ["id", "count", "type"],
"swords": ["id", "count", "name"],
"boats": ["id", "count", "name", "type", "crew_id", "captain_id"],
"crews": ["id", "count", "name", "status", "yonko"],
}

STRING_SEARCHES = ["name", "job", "bounty", "status", "size", "type"]
STRING_SEARCHES = ["name", "job", "bounty", "status", "size", "type", "tome_name", "roman_name", "sea", "affiliation"]
ID_SEARCHES = ["crew_id", "captain_id"]
NO_SEARCH_ID_SEARCHES = ["saga_id", "arc_id"]
NO_SEARCH_ID_SEARCHES = ["saga_id", "arc_id", "characters_id", "gear_id", "tome_id"]
NO_RESOURCE_SEARCHES = ["count", "yonko"]


Expand Down Expand Up @@ -51,7 +51,7 @@ def build_url(endpoint, search=None, resource_id=None):
def adding_search(endpoint, search, resource_id=None):
if search in STRING_SEARCHES:
return f"{URL}{endpoint}/search/{search}/{resource_id}"
elif search in ID_SEARCHES:
elif search in ID_SEARCHES or (endpoint == "arcs" and 'id' in search and search != "id"):
return f"{URL}{endpoint}/search/{search[:-3]}/{resource_id}"
elif search in NO_SEARCH_ID_SEARCHES:
return f"{URL}{endpoint}/{search[:-3]}/{resource_id}"
Expand All @@ -67,4 +67,4 @@ def convert_name(name):


def pretty_print(data):
return json.dumps(data, indent=4)
return json.dumps(data, indent=4, ensure_ascii=False).encode("utf8").decode()
Loading

0 comments on commit 30995ae

Please sign in to comment.