Skip to content

Commit

Permalink
fix: proper statement for e6 stuff sigh
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkaroid committed Dec 7, 2022
1 parent a25c422 commit f8cba6f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
18 changes: 7 additions & 11 deletions booru/client/e621.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import aiohttp
from typing import Union
from ..utils.fetch import request, roll
from ..utils.constant import Api, better_object, parse_image, get_hostname
Expand All @@ -16,7 +15,7 @@ class E621(object):
Search and gets images from e621.
search_image : function
Gets images, meant just image urls from e621.
Search and gets images from e621, but only returns image.
"""

Expand Down Expand Up @@ -48,10 +47,10 @@ def __init__(self, api_key: str = "", user_id: str = ""):
Parameters
----------
api_key : str
Your API Key which is accessible within your account options page
Your API Key (If possible)
user_id : str
Your user ID, which is accessible on the account options/profile page.
Your user ID (If possible)
"""

if api_key and user_id == "":
Expand All @@ -70,7 +69,7 @@ async def search(
page: int = 1,
random: bool = True,
gacha: bool = False,
) -> Union[aiohttp.ClientResponse, str]:
) -> Union[list, str, None]:

"""Search and gets images from e621.
Expand All @@ -96,13 +95,11 @@ async def search(
dict
The json object returned by e621.
"""
if gacha:
limit = 100

if limit > 1000:
raise ValueError(Booru.error_handling_limit)
else:
self.query = query

self.query = query
self.specs["tags"] = self.query
self.specs["limit"] = limit
self.specs["page"] = page
Expand All @@ -123,7 +120,7 @@ async def search(

async def search_image(
self, query: str, limit: int = 100, page: int = 1
) -> Union[aiohttp.ClientResponse, str]:
) -> Union[list, str, None]:

"""Gets images, meant just image urls from e621.
Expand All @@ -148,7 +145,6 @@ async def search_image(
if limit > 1000:
raise ValueError(Booru.error_handling_limit)


self.query = query
self.specs["tags"] = self.query
self.specs["limit"] = limit
Expand Down
19 changes: 8 additions & 11 deletions booru/client/e926.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import aiohttp
from typing import Union
from ..utils.fetch import request, roll
from ..utils.constant import Api, better_object, parse_image, get_hostname
from random import shuffle, randint
from random import shuffle

Booru = Api()

Expand All @@ -16,7 +15,7 @@ class E926(object):
Search and gets images from e926.
search_image : function
Gets images, meant just image urls from e926.
Search and gets images from e926, but only returns image.
"""

Expand Down Expand Up @@ -48,10 +47,10 @@ def __init__(self, api_key: str = "", user_id: str = ""):
Parameters
----------
api_key : str
Your API Key which is accessible within your account options page
Your API Key (If possible)
user_id : str
Your user ID, which is accessible on the account options/profile page.
Your user ID (If possible)
"""

if api_key and user_id == "":
Expand All @@ -70,7 +69,7 @@ async def search(
page: int = 1,
random: bool = True,
gacha: bool = False,
) -> Union[aiohttp.ClientResponse, str]:
) -> Union[list, str, None]:

"""Search and gets images from e926.
Expand All @@ -96,13 +95,11 @@ async def search(
dict
The json object returned by e926.
"""
if gacha:
limit = 100

if limit > 1000:
raise ValueError(Booru.error_handling_limit)
else:
self.query = query

self.query = query
self.specs["tags"] = self.query
self.specs["limit"] = limit
self.specs["page"] = page
Expand All @@ -123,7 +120,7 @@ async def search(

async def search_image(
self, query: str, limit: int = 100, page: int = 1
) -> Union[aiohttp.ClientResponse, str]:
) -> Union[list, str, None]:

"""Gets images, meant just image urls from e926.
Expand Down

0 comments on commit f8cba6f

Please sign in to comment.