Skip to content

Instantly share code, notes, and snippets.

@Celeo
Created April 27, 2018 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Celeo/69d8fc12ed082a2bffae702ddeb8ba73 to your computer and use it in GitHub Desktop.
Save Celeo/69d8fc12ed082a2bffae702ddeb8ba73 to your computer and use it in GitHub Desktop.
Preston: scope(s) for operationId
def print_scopes_for_op_id(preston, op_id):
path = p._get_path_for_op_id(op_id)
print(f'Path for operationId "{op_id}" is "{path}"')
path_spec = p._get_spec()['paths'][path]
for key in path_spec:
if path_spec[key].get('security'):
print(f'"{path} :: {key}" requires scopes: ' + ', '.join(path_spec[key]['security'][0]['evesso']))
op_id = 'get_characters_character_id_stats'
p = Preston()
print_scopes_for_op_id(p, op_id)
@Celeo
Copy link
Author

Celeo commented Apr 27, 2018

$ python get_scopes.py

Path for operationId "get_characters_character_id_stats" is "/v2/characters/{character_id}/stats/"
"/v2/characters/{character_id}/stats/ :: get" requires scopes: esi-characterstats.read.v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment