2121import asyncio
2222import json
2323import logging
24+ import ssl
2425from typing import Optional
2526
2627import httpx
@@ -114,7 +115,7 @@ async def fetch_and_sync_initial_blocks(self):
114115 batch_ranges = []
115116 blocks_fetched = True
116117
117- async with httpx .AsyncClient () as client :
118+ async with httpx .AsyncClient (verify = False ) as client :
118119 while blocks_fetched :
119120 min_seq = self .current_block_number + 1
120121 max_seq = min_seq + batch_size - 1
@@ -158,7 +159,7 @@ async def fetch_and_sync_initial_blocks(self):
158159 async def fetch_and_sync_batch (self , min_seq : int , max_seq : int , semaphore : asyncio .Semaphore ):
159160 async with semaphore :
160161 try :
161- async with httpx .AsyncClient () as client :
162+ async with httpx .AsyncClient (verify = False ) as client :
162163 url = f"{ self .http_endpoint } /{ min_seq } /{ max_seq } "
163164 logger .info (f"Fetching blocks from { min_seq } to { max_seq } " )
164165 response = await client .get (url )
@@ -217,7 +218,7 @@ async def fetch_and_sync_new_blocks(self):
217218 batch_ranges = []
218219 blocks_fetched = True
219220
220- async with httpx .AsyncClient () as client :
221+ async with httpx .AsyncClient (verify = False ) as client :
221222 while blocks_fetched :
222223 min_seq = self .current_block_number + 1
223224 max_seq = min_seq + batch_size - 1
@@ -251,7 +252,12 @@ async def fetch_and_sync_new_blocks(self):
251252
252253 async def connect_websocket (self ):
253254 try :
254- async with websockets .connect (self .ws_endpoint ) as websocket :
255+ # Create SSL context that doesn't verify certificates
256+ ssl_context = ssl .create_default_context ()
257+ ssl_context .check_hostname = False
258+ ssl_context .verify_mode = ssl .CERT_NONE
259+
260+ async with websockets .connect (self .ws_endpoint , ssl = ssl_context ) as websocket :
255261 logger .info (f"Connected to WebSocket: { self .ws_endpoint } " )
256262 self .reconnect_attempts = 0
257263 self .emit ('connected' )
@@ -318,4 +324,4 @@ async def close(self):
318324 except Exception as e :
319325 logger .error ("Error closing connections:" )
320326 logger .error (e )
321- raise ResilientPythonCacheError (str (e )) from e
327+ raise ResilientPythonCacheError (str (e )) from e
0 commit comments