@@ -130,6 +130,9 @@ class Client:
130130 Setting this to True, will signal to the API that you intend to be nice to other users
131131 by de-prioritizing your request below concurrent ones.
132132
133+ verify_ssl(bool, optional, default True)
134+ Setting this to False will disable checking for SSL when doing requests.
135+
133136 Example usage:
134137 >>> request = CompletionRequest(
135138 prompt=Prompt.from_text(f"Request"), maximum_tokens=64
@@ -146,6 +149,7 @@ def __init__(
146149 request_timeout_seconds : int = DEFAULT_REQUEST_TIMEOUT ,
147150 total_retries : int = 8 ,
148151 nice : bool = False ,
152+ verify_ssl = True ,
149153 ) -> None :
150154 if host [- 1 ] != "/" :
151155 host += "/"
@@ -164,6 +168,7 @@ def __init__(
164168 )
165169 adapter = HTTPAdapter (max_retries = retry_strategy )
166170 self .session = requests .Session ()
171+ self .session .verify = verify_ssl
167172 self .session .headers = CaseInsensitiveDict (
168173 {
169174 "Authorization" : "Bearer " + self .token ,
@@ -603,6 +608,9 @@ class AsyncClient:
603608 Setting this to True, will signal to the API that you intend to be nice to other users
604609 by de-prioritizing your request below concurrent ones.
605610
611+ verify_ssl(bool, optional, default True)
612+ Setting this to False will disable checking for SSL when doing requests.
613+
606614 Example usage:
607615 >>> request = CompletionRequest(prompt=Prompt.from_text(f"Request"), maximum_tokens=64)
608616 >>> async with AsyncClient(token=os.environ["AA_TOKEN"]) as client:
@@ -617,6 +625,7 @@ def __init__(
617625 request_timeout_seconds : int = DEFAULT_REQUEST_TIMEOUT ,
618626 total_retries : int = 8 ,
619627 nice : bool = False ,
628+ verify_ssl = True ,
620629 ) -> None :
621630 if host [- 1 ] != "/" :
622631 host += "/"
@@ -632,6 +641,7 @@ def __init__(
632641 start_timeout = 0.25 ,
633642 statuses = set (RETRY_STATUS_CODES ),
634643 )
644+ connector = aiohttp .TCPConnector (verify_ssl = verify_ssl )
635645 self .session = RetryClient (
636646 trust_env = True , # same behaviour as requests/(Sync)Client wrt. http_proxy
637647 raise_for_status = False ,
@@ -642,6 +652,7 @@ def __init__(
642652 "User-Agent" : "Aleph-Alpha-Python-Client-"
643653 + aleph_alpha_client .__version__ ,
644654 },
655+ connector = connector
645656 )
646657
647658 async def close (self ):
0 commit comments