Skip to content

Commit

Permalink
Change http_library parameter to http_client
Browse files Browse the repository at this point in the history
dev-ruby committed Apr 11, 2024
1 parent 4af6c1e commit 23b8089
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions solvedac_community/client.py
Original file line number Diff line number Diff line change
@@ -25,17 +25,19 @@


class Client:
__loop: asyncio.AbstractEventLoop
__http_client: AbstractHTTPClient
__has_token: bool

def __init__(self, solvedac_token: Optional[str] = None, http_library: HTTPClientLibrary = None) -> None:
def __init__(self, solvedac_token: Optional[str] = None, http_client: AbstractHTTPClient = None) -> None:
try:
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
except AttributeError:
pass
self.__loop = asyncio.get_event_loop()
self.__http_client = get_http_client(self.__loop, solvedac_token=solvedac_token, lib=http_library)

if http_client is None:
self.__http_client = get_http_client(solvedac_token=solvedac_token)
else:
self.__http_client = http_client
self.__has_token = bool(solvedac_token)

async def get_user(self, handle: str) -> Models.User:
@@ -272,7 +274,9 @@ async def verify_account_credentials(self) -> Models.AccountInfo:
:return: :class:`Models.AccountInfo`
"""

response: ResponseData = await self.__http_client.request(Route(RequestMethod.GET, "/account/verify_credentials"))
response: ResponseData = await self.__http_client.request(
Route(RequestMethod.GET, "/account/verify_credentials")
)

check_stats_code(response.status)

0 comments on commit 23b8089

Please sign in to comment.