Mediahaven-python Index / MediaHaven / Oauth2
Auto-generated documentation for mediahaven.oauth2 module.
Raised when a token has not been requested yet.
class NoTokenError(Exception):
def __init__(self):
...Abstract class representing an OAuth2 grant used in MediaHaven.
class OAuth2Grant(ABC):
def __init__(self, mh_base_url: str, client_id: str, client_secret: str):
...Refresh the OAuth2 token with the saved refresh token.
Issues a new access token but also a new refresh token.
def refresh_token(self):
...@abstractmethod
def request_token(self):
...Represents a "Resource Owner Password Credential" grant.
class ROPCGrant(OAuth2Grant):
def __init__(self, mh_base_url: str, client_id: str, client_secret: str):
...Request an OAuth2 token.
The resource owner grants the client the authorization to execute the requests on its behalf. Given the credentials of the resource owner, an auth token is issued by the authorization server. This token will be saved in memory and used by the session in order to execute authorized requests.
username- The username of the resource owner.password- The password of the resource owner.
RequestTokenException- When an error occurred when requesting the token.
def request_token(self, username: str, password: str):
...Raised when an error occurred during token request.
Abstracts the underlying OAuthlib2 errors.
class RefreshTokenError(Exception):
def __init__(self):
...Raised when an error occurred during token request.
Abstracts the underlying OAuthlib2 errors.
class RequestTokenError(Exception):
def __init__(self):
...