forked from LBRYCommunity/lbry-sdk
typing
This commit is contained in:
parent
10d73fe480
commit
f52e44b56a
1 changed files with 2 additions and 2 deletions
|
@ -163,14 +163,14 @@ async def resolve_host(url: str, port: int, proto: str) -> str:
|
|||
))[0][4][0]
|
||||
|
||||
|
||||
def get_ssl_context():
|
||||
def get_ssl_context() -> ssl.SSLContext:
|
||||
return ssl.create_default_context(
|
||||
purpose=ssl.Purpose.CLIENT_AUTH, capath=None if 'darwin' not in sys.platform else certifi.where()
|
||||
)
|
||||
|
||||
|
||||
@contextlib.asynccontextmanager
|
||||
async def aiohttp_request(method, url, **kwargs):
|
||||
async def aiohttp_request(method, url, **kwargs) -> typing.AsyncContextManager[aiohttp.ClientResponse]:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.request(method, url, ssl=get_ssl_context(), **kwargs) as response:
|
||||
yield response
|
||||
|
|
Loading…
Reference in a new issue