Skip to content

Commit fac24ba

Browse files
committed
Fix type issue
1 parent 40b6d5a commit fac24ba

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

pinecone/admin/admin.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,24 @@ def __init__(
6363

6464
if client_id is not None:
6565
self._client_id = client_id
66-
elif os.getenv("PINECONE_CLIENT_ID") is not None:
67-
self._client_id = os.getenv("PINECONE_CLIENT_ID")
6866
else:
69-
raise ValueError(
70-
"client_id is not set. Pass client_id to the Admin constructor or set the PINECONE_CLIENT_ID environment variable."
71-
)
67+
env_client_id = os.environ.get("PINECONE_CLIENT_ID", None)
68+
if env_client_id is None:
69+
raise ValueError(
70+
"client_id is not set. Pass client_id to the Admin constructor or set the PINECONE_CLIENT_ID environment variable."
71+
)
72+
self._client_id = env_client_id
73+
7274
if client_secret is not None:
7375
self._client_secret = client_secret
74-
elif os.getenv("PINECONE_CLIENT_SECRET") is not None:
75-
self._client_secret = os.getenv("PINECONE_CLIENT_SECRET")
7676
else:
77-
raise ValueError(
78-
"client_secret is not set. Pass client_secret to the Admin constructor or set the PINECONE_CLIENT_SECRET environment variable."
79-
)
77+
env_client_secret = os.environ.get("PINECONE_CLIENT_SECRET", None)
78+
if env_client_secret is None:
79+
raise ValueError(
80+
"client_secret is not set. Pass client_secret to the Admin constructor or set the PINECONE_CLIENT_SECRET environment variable."
81+
)
82+
self._client_secret = env_client_secret
83+
8084
if additional_headers is None:
8185
additional_headers = {}
8286

0 commit comments

Comments
 (0)