Tokens
load_token(path: Path = TOKEN_PATH, encoding: str = DEFAULT_ENCODING, errors: str = DEFAULT_ERRORS) -> str
Loads the token from the given path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
Path
|
The path to the token file. |
TOKEN_PATH
|
encoding |
str
|
The encoding to use. |
DEFAULT_ENCODING
|
errors |
str
|
The error handling of the encoding to use. |
DEFAULT_ERRORS
|
Returns:
| Type | Description |
|---|---|
str
|
The loaded token. |
Raises:
| Type | Description |
|---|---|
TokenNotFound
|
|
Source code in aoc/tokens.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
dump_token(token: str, path: Path = TOKEN_PATH, encoding: str = DEFAULT_ENCODING, errors: str = DEFAULT_ERRORS) -> None
Dumps the token to the given path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token |
str
|
The token to dump. |
required |
path |
Path
|
The path to the token file. |
TOKEN_PATH
|
encoding |
str
|
The encoding to use. |
DEFAULT_ENCODING
|
errors |
str
|
The error handling of the encoding to use. |
DEFAULT_ERRORS
|
Source code in aoc/tokens.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
remove_token(path: Path = TOKEN_PATH) -> None
Removes the token at the given path.
This function does nothing if the path does not exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
Path
|
The path to the token file. |
TOKEN_PATH
|
Source code in aoc/tokens.py
48 49 50 51 52 53 54 55 56 | |