paperap.auth module


METADATA:

File: auth.py

Project: paperap

Created: 2025-03-04

Version: 0.0.9

Author: Jess Mann Email: jess@jmann.me

Copyright (c) 2025 Jess Mann


LAST MODIFIED:

2025-03-04 By Jess Mann

class paperap.auth.AuthBase(**data)[source]

Bases: BaseModel, ABC

Base authentication class.

Parameters:

data (Any)

model_config: ClassVar[ConfigDict] = {'str_strip_whitespace': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

abstractmethod get_auth_headers()[source]

Get authentication headers.

Return type:

dict[str, str]

abstractmethod get_auth_params()[source]

Get authentication parameters for requests.

Return type:

dict[str, Any]

class paperap.auth.TokenAuth(**data)[source]

Bases: AuthBase

Authentication using a token.

Parameters:

data (Any)

token: Annotated[str, Field(min_length=30, max_length=75, pattern='^[a-zA-Z0-9]+$')]
get_auth_headers()[source]

Get the authorization headers.

Return type:

dict[str, str]

get_auth_params()[source]

Get authentication parameters for requests.

Return type:

dict[str, Any]

model_config: ClassVar[ConfigDict] = {'str_strip_whitespace': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class paperap.auth.BasicAuth(**data)[source]

Bases: AuthBase

Authentication using username and password.

Parameters:

data (Any)

username: str
password: str
get_auth_headers()[source]

Get headers for basic auth.

Basic auth is handled by the requests library, so no headers are needed here.

Return type:

dict[str, str]

get_auth_params()[source]

Get authentication parameters for requests.

Return type:

dict[str, Any]

model_config: ClassVar[ConfigDict] = {'str_strip_whitespace': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].