Update a Pangea API token
Modify a Pangea API token
You may need to update a Pangea API token to add tags or metadata. Tags and metadata can be helpful in identifying what the Pangea API token is used for and for finding the Pangea API token via search.
import os
import pangea.exceptions as pe
from pangea.config import PangeaConfig
from pangea.services import Vault
def update_token_metadata(token_id, new_meta):
token = os.getenv("PANGEA_VAULT_TOKEN")
domain = os.getenv("PANGEA_DOMAIN")
config = PangeaConfig(domain=domain)
vault = Vault(token, config=config)
try:
# use other keywords to update other fields
vault.update(token_id, metadata=new_meta)
except pe.PangeaAPIException as e:
print(f"Vault Request Error: {e.response.summary}")
for err in e.errors:
print(f"\t{err.detail} \n")
return
Was this article helpful?