MCPcopy Create free account
hub / github.com/Virtual-Protocol/virtuals-python / get_access_token

Function get_access_token

src/virtuals_sdk/game/utils.py:5–19  ·  view source on GitHub ↗

API call to get access token

(api_key)

Source from the content-addressed store, hash-verified

3
4
5def get_access_token(api_key) -> str:
6 """
7 API call to get access token
8 """
9 response = requests.post(
10 "https://api.virtuals.io/api/accesses/tokens",
11 json={"data": {}},
12 headers={"x-api-key": api_key}
13 )
14
15 response_json = response.json()
16 if response.status_code != 200:
17 raise ValueError(f"Failed to get token: {response_json}")
18
19 return response_json["data"]["accessToken"]
20
21
22def post(base_url: str, api_key: str, endpoint: str, data: dict) -> dict:

Callers 1

postFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected