Click a link to jump to the indicated section.
class
bluecat.gateway._internal.sessions.micetro.UserSession
(username, unique_name='', *, api, platform=None, **_)
User session
property
authentication_url
The base URL for the authentication of the session.
It contains only the scheme, host, and (if explicitly specified in the configuration) port.
Return type: str
New in version 23.1.0.
property
logger
A logger that can be used to log messages which will have a context value unique to this user session. This is useful when identifying or tracing a user’s activities in logs.
In practice, this is a LoggerAdapter
. As such it has a
slightly more limited interface than a full-fledged
logging.Logger
. Do not (attempt to) change its logging level.
Return type: LoggerAdapter
property
logger_context
A value included in the log messages made via the logger
of this
user session. It is unique to this user session as it derives from the
username and the session.
This is useful when identifying or tracing a user’s activities in logs.
Return type: str
property
micetro_api
The structure for accessing the already authenticated Micetro API clients, provided by the platform.
Example:
from bluecat import route
from bluecat_libraries.micetro.apiv2 import Client
from flask import g, jsonify
def get_micetro_servers(client: Client):
# Implement using Micetro REST API
data = client.http_get("/servers", ...)
# process data
return data
@route(app, "/example/servers")
def get_servers():
data = get_micetro_servers(g.user.micetro_api.v2)
return jsonify(data)
Return type: MicetroAPI
property
micetro_auth
The authentication used by the Python client to the Micetro API.
This property does not support assignment.
Return type: str
property
micetro_url
The base URL to the Micetro the session is for.
It contains only the scheme, host, and (if explicitly specified in the configuration) port.
Return type: str
property
session_auth
The authentication value identifying this user session in Gateway.
This property does not support assignment.
Return type: str
property
username
The username of the currently logged-in user.
This property does not support assignment.
Return type: str