Something went wrong. Try again.
Command line interface for accessing the Open Web Index shards and slices.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344
import asyncioimport httpximport osfrom py4lexis.session import LexisSessionfrom py4lexis.core.lexis_irods import iRODS
class OWIIrods(iRODS): def get_client(self): self._iRODS__check_access_token() return self._irds
async def check_http2(): # reused session logic token_path = os.path.expanduser("~/tmp/refresh_token.txt") try: with open(token_path, "r") as f: refresh_token = f.read().strip() session = LexisSession(login_method="token", refresh_token=refresh_token) except FileNotFoundError: session = LexisSession()
irods_wrapper = OWIIrods(session=session) client = irods_wrapper.get_client() # iClient has .token property according to previous analysis of collection_operations.py # collection_operations.py: self.sess.token # irodsHttpClient (client): has .token property token = client.token url_base = client.url_base print(f"Checking HTTP/2 support for: {url_base}") async with httpx.AsyncClient(http2=True, verify=False) as http_client: try: response = await http_client.get(f"{url_base}/info", headers={"Authorization": f"Bearer {token}"}) print(f"Protocol: {response.http_version}") print(f"Status: {response.status_code}") except Exception as e: print(f"Error: {e}")
if __name__ == "__main__": asyncio.run(check_http2())