MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / refresh

Function refresh

dwave/cloud/cli.py:1082–1096  ·  view source on GitHub ↗

Refresh Leap API access token.

(*, config_file, profile, output)

Source from the content-addressed store, hash-verified

1080@config_file_options()
1081@standardized_output
1082def refresh(*, config_file, profile, output):
1083 """Refresh Leap API access token."""
1084
1085 config = validate_config_v1(load_config(config_file=config_file, profile=profile))
1086
1087 with LeapAuthFlow.from_config_model(config) as flow:
1088 # check we have a token
1089 if not flow.token or 'refresh_token' not in flow.token:
1090 raise CLIError('Refresh token not found. Please run "dwave auth login".', code=100)
1091
1092 # refresh
1093 flow.refresh_token()
1094
1095 output('Access and refresh tokens successfully refreshed. '
1096 'You can now use "dwave auth get" to view them.')
1097
1098
1099@auth.command()

Callers

nothing calls this directly

Calls 6

validate_config_v1Function · 0.90
load_configFunction · 0.90
CLIErrorClass · 0.90
outputFunction · 0.85
refresh_tokenMethod · 0.80
from_config_modelMethod · 0.45

Tested by

no test coverage detected