Skip to content

Commit 23b8089

Browse files
committed
Change http_library parameter to http_client
1 parent 4af6c1e commit 23b8089

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

solvedac_community/client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@
2525

2626

2727
class Client:
28-
__loop: asyncio.AbstractEventLoop
2928
__http_client: AbstractHTTPClient
3029
__has_token: bool
3130

32-
def __init__(self, solvedac_token: Optional[str] = None, http_library: HTTPClientLibrary = None) -> None:
31+
def __init__(self, solvedac_token: Optional[str] = None, http_client: AbstractHTTPClient = None) -> None:
3332
try:
3433
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
3534
except AttributeError:
3635
pass
37-
self.__loop = asyncio.get_event_loop()
38-
self.__http_client = get_http_client(self.__loop, solvedac_token=solvedac_token, lib=http_library)
36+
37+
if http_client is None:
38+
self.__http_client = get_http_client(solvedac_token=solvedac_token)
39+
else:
40+
self.__http_client = http_client
3941
self.__has_token = bool(solvedac_token)
4042

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

275-
response: ResponseData = await self.__http_client.request(Route(RequestMethod.GET, "/account/verify_credentials"))
277+
response: ResponseData = await self.__http_client.request(
278+
Route(RequestMethod.GET, "/account/verify_credentials")
279+
)
276280

277281
check_stats_code(response.status)
278282

0 commit comments

Comments
 (0)