hermes.commands.init.oauth_process

Attributes

Classes

OauthProcess

Handler

Simple implementation of BaseHTTPRequestHandler for getting oauth responses

Functions

setup_logging_for_oauthlib()

This makes requests_oauthlib.oauth2_session print all the debug logs onto the console.

parse_response_to_dict(→ dict)

extract_value(value)

Module Contents

hermes.commands.init.oauth_process.PREFER_DEVICE_FLOW = True
hermes.commands.init.oauth_process.DEACTIVATE_BROWSER_OPENING = False
hermes.commands.init.oauth_process.setup_logging_for_oauthlib()

This makes requests_oauthlib.oauth2_session print all the debug logs onto the console. It only works if the hermes logger is deactivated.

hermes.commands.init.oauth_process.parse_response_to_dict(response_text: str) dict
hermes.commands.init.oauth_process.extract_value(value)
class hermes.commands.init.oauth_process.OauthProcess(name: str, client_id: str = '', client_secret: str = '', authorize_url: str = '', token_url: str = '', scope: str = '', local_port: int = 5333, device_code_url: str = '')
name
local_port = 5333
scope = ''
client_id = ''
client_secret = ''
authorize_url = ''
token_url = ''
redirect_uri = 'http://localhost:/callback'
shutdown_event
tokens
device_code_url = ''
server: http.server.HTTPServer = None
create_handler_constructor()
start_server(port: int = None)
kill_server()
open_browser(port: int = None) bool
get_tokens_from_refresh_token(refresh_token: str) dict[str:str]

Returns access and refresh token as dict using a refresh token

get_tokens_from_auth_code(auth_code: str) dict[str:str]

Returns access and refresh token as dict using an auth-code

get_tokens_from_device_flow() dict[str:str]
get_tokens_from_oauth() dict[str:str]
get_tokens() dict[str:str]
class hermes.commands.init.oauth_process.Handler(*args, oauth_process: OauthProcess = None, **kwargs)

Bases: http.server.BaseHTTPRequestHandler

Simple implementation of BaseHTTPRequestHandler for getting oauth responses

oauth_process = None
do_GET()
index()
callback()
log_request(code='-', size='-')

Log an accepted request.

This is called by send_response().