diff --git a/src/onepasswordconnectsdk/async_client.py b/src/onepasswordconnectsdk/async_client.py index 4dd5467..7df6ad1 100644 --- a/src/onepasswordconnectsdk/async_client.py +++ b/src/onepasswordconnectsdk/async_client.py @@ -2,7 +2,7 @@ import httpx from httpx import HTTPError import json -from typing import Dict, List +from typing import Dict, List, Union import os from onepasswordconnectsdk.serializer import Serializer @@ -57,7 +57,7 @@ async def get_files(self, item_id: str, vault_id: str) -> List[File]: ) return self.serializer.deserialize(response.content, "list[File]") - async def get_file_content(self, file_id: str, item_id: str, vault_id: str, content_path: str = None) -> bytes | str: + async def get_file_content(self, file_id: str, item_id: str, vault_id: str, content_path: str = None) -> Union[bytes, str]: url = content_path if content_path is None: url = PathBuilder().vaults(vault_id).items(item_id).files(file_id).content().build() diff --git a/src/onepasswordconnectsdk/client.py b/src/onepasswordconnectsdk/client.py index b0674a7..a62bae1 100644 --- a/src/onepasswordconnectsdk/client.py +++ b/src/onepasswordconnectsdk/client.py @@ -2,7 +2,7 @@ import httpx from httpx import HTTPError import json -from typing import Dict, List +from typing import Dict, List, Union import os from onepasswordconnectsdk.async_client import AsyncClient @@ -64,7 +64,7 @@ def get_files(self, item_id: str, vault_id: str) -> List[File]: ) return self.serializer.deserialize(response.content, "list[File]") - def get_file_content(self, file_id: str, item_id: str, vault_id: str, content_path: str = None) -> bytes | str: + def get_file_content(self, file_id: str, item_id: str, vault_id: str, content_path: str = None) -> Union[bytes, str]: url = content_path if content_path is None: url = PathBuilder().vaults(vault_id).items(item_id).files(file_id).content().build() @@ -381,7 +381,7 @@ def sanitize_for_serialization(self, obj): return self.serializer.sanitize_for_serialization(obj) -def new_client(url: str, token: str, is_async: bool = False) -> AsyncClient | Client: +def new_client(url: str, token: str, is_async: bool = False) -> Union[AsyncClient, Client]: """Builds a new client for interacting with 1Password Connect Parameters: url: The url of the 1Password Connect API @@ -396,7 +396,7 @@ def new_client(url: str, token: str, is_async: bool = False) -> AsyncClient | Cl return Client(url, token) -def new_client_from_environment(url: str = None) -> AsyncClient | Client: +def new_client_from_environment(url: str = None) -> Union[AsyncClient, Client]: """Builds a new client for interacting with 1Password Connect using the OP_TOKEN environment variable