From 29e35636dbc9887e89379e7a97eb2327f22938c6 Mon Sep 17 00:00:00 2001 From: Dominick Meglio Date: Sat, 28 Dec 2024 19:28:10 -0500 Subject: [PATCH 1/2] Allow passing an SSLContext instead of creating a new one. --- xbox/webapi/common/signed_session.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xbox/webapi/common/signed_session.py b/xbox/webapi/common/signed_session.py index b5fc26f8..4b1d6a03 100644 --- a/xbox/webapi/common/signed_session.py +++ b/xbox/webapi/common/signed_session.py @@ -3,14 +3,16 @@ A wrapper around httpx' AsyncClient which transparently calculates the "Signature" header. """ +from ssl import SSLContext import httpx from xbox.webapi.common.request_signer import RequestSigner class SignedSession(httpx.AsyncClient): - def __init__(self, request_signer=None): - super().__init__() + def __init__(self, request_signer=None, ssl_context: SSLContext=None): + super().__init__(verify=ssl_context if ssl_context is not None else True) + self.request_signer = request_signer or RequestSigner() @classmethod From 3924eec32bd6c673693229a85075ac508129ba22 Mon Sep 17 00:00:00 2001 From: Dominick Meglio Date: Sat, 28 Dec 2024 22:44:59 -0500 Subject: [PATCH 2/2] Order imports properly. --- xbox/webapi/common/signed_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbox/webapi/common/signed_session.py b/xbox/webapi/common/signed_session.py index 4b1d6a03..6f7e9041 100644 --- a/xbox/webapi/common/signed_session.py +++ b/xbox/webapi/common/signed_session.py @@ -3,9 +3,9 @@ A wrapper around httpx' AsyncClient which transparently calculates the "Signature" header. """ -from ssl import SSLContext import httpx +from ssl import SSLContext from xbox.webapi.common.request_signer import RequestSigner