Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions weaviate/connect/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ def __parse_weaviate_cloud_cluster_url(cluster_url: str) -> Tuple[str, str]:


def __parse_auth_credentials(creds: Union[str, AuthCredentials, None]) -> Optional[AuthCredentials]:
if isinstance(creds, str):
if creds is None:
# If no credentials are provided, return None.
return None
elif isinstance(creds, str):
# If the credentials are a string, assume it's an API key.
return Auth.api_key(creds)
elif isinstance(
creds, (_BearerToken, _ClientPassword, _ClientCredentials, _APIKey)
): # use AuthCredentials after python 3.9 has been removed
# If the credentials are already an AuthCredentials object, return it as is.
return creds
elif creds is None:
# If no credentials are provided, return None.
return None
else:
raise ValueError("Invalid auth credentials provided.")

Expand Down