pinecone.info
1from pinecone.core.api_action import ActionAPI, VersionResponse, WhoAmIResponse 2from pinecone.config import Config 3 4import time 5import requests 6 7__all__ = ["version", "whoami", "VersionResponse", "WhoAmIResponse"] 8 9 10def _get_action_api(): 11 return ActionAPI(host=Config.CONTROLLER_HOST, api_key=Config.API_KEY) 12 13 14def version() -> VersionResponse: 15 """Returns version information (client and server).""" 16 api = _get_action_api() 17 return api.version() 18 19 20def whoami() -> WhoAmIResponse: 21 """Returns the details of the currently authenticated API key.""" 22 api = _get_action_api() 23 return api.whoami() 24 25 26def wait_controller_ready(timeout: int = 30): 27 connection = False 28 max_time = time.time() + timeout 29 while (not connection) and time.time() < max_time: 30 try: 31 version() 32 time.sleep(3) 33 connection = True 34 except requests.exceptions.ConnectionError: 35 time.sleep(1)
15def version() -> VersionResponse: 16 """Returns version information (client and server).""" 17 api = _get_action_api() 18 return api.version()
Returns version information (client and server).
21def whoami() -> WhoAmIResponse: 22 """Returns the details of the currently authenticated API key.""" 23 api = _get_action_api() 24 return api.whoami()
Returns the details of the currently authenticated API key.
class
VersionResponse(typing.NamedTuple):
VersionResponse(server, client)
Inherited Members
- builtins.tuple
- index
- count
class
WhoAmIResponse(typing.NamedTuple):
10class WhoAmIResponse(NamedTuple): 11 username: str = "UNKNOWN" 12 user_label: str = "UNKNOWN" 13 projectname: str = "UNKNOWN"
WhoAmIResponse(username, user_label, projectname)
WhoAmIResponse( username: str = 'UNKNOWN', user_label: str = 'UNKNOWN', projectname: str = 'UNKNOWN')
Create new instance of WhoAmIResponse(username, user_label, projectname)
Inherited Members
- builtins.tuple
- index
- count