Skip to content

Latest commit

 

History

History
157 lines (97 loc) · 3.13 KB

File metadata and controls

157 lines (97 loc) · 3.13 KB

Oauth2

Mediahaven-python Index / MediaHaven / Oauth2

Auto-generated documentation for mediahaven.oauth2 module.

NoTokenError

Show source in oauth2.py:38

Raised when a token has not been requested yet.

Signature

class NoTokenError(Exception):
    def __init__(self):
        ...

OAuth2Grant

Show source in oauth2.py:45

Abstract class representing an OAuth2 grant used in MediaHaven.

Signature

class OAuth2Grant(ABC):
    def __init__(self, mh_base_url: str, client_id: str, client_secret: str):
        ...

OAuth2Grant().refresh_token

Show source in oauth2.py:67

Refresh the OAuth2 token with the saved refresh token.

Issues a new access token but also a new refresh token.

Signature

def refresh_token(self):
    ...

OAuth2Grant().request_token

Show source in oauth2.py:63

Signature

@abstractmethod
def request_token(self):
    ...

ROPCGrant

Show source in oauth2.py:96

Represents a "Resource Owner Password Credential" grant.

Signature

class ROPCGrant(OAuth2Grant):
    def __init__(self, mh_base_url: str, client_id: str, client_secret: str):
        ...

See also

ROPCGrant().request_token

Show source in oauth2.py:104

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.

Arguments

  • username - The username of the resource owner.
  • password - The password of the resource owner.

Raises

  • RequestTokenException - When an error occurred when requesting the token.

Signature

def request_token(self, username: str, password: str):
    ...

RefreshTokenError

Show source in oauth2.py:28

Raised when an error occurred during token request.

Abstracts the underlying OAuthlib2 errors.

Signature

class RefreshTokenError(Exception):
    def __init__(self):
        ...

RequestTokenError

Show source in oauth2.py:18

Raised when an error occurred during token request.

Abstracts the underlying OAuthlib2 errors.

Signature

class RequestTokenError(Exception):
    def __init__(self):
        ...