oldas.session
Provides a class for getting and managing a login session.
Session
Session(
client: str,
auth_code: str | None = None,
timeout: int = 60,
logger: Logger | None = None,
)
Class for handling a TheOldReader login session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The name of the client that is logging in. |
required |
|
str | None
|
Optional authorisation code to resume a session. |
None
|
|
int
|
The timeout in seconds to use when making calls. |
60
|
|
Logger | None
|
Optional logging object. |
None
|
Note
The client should be a unique name you give your client
application that is using this library.
add_tag
async
get
async
Make a GET call to the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The endpoint to call. |
required |
|
Any
|
Any extra parameters that need to be passed. |
{}
|
Returns:
| Type | Description |
|---|---|
RawData
|
A dictionary that is the JSON data. |
Raises:
| Type | Description |
|---|---|
OldASError
|
If there was an error connecting or logging in. |
login
async
Log into TheOldReader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The user name to log in with. |
required |
|
str
|
The password to log in with. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Self. |
Raises:
| Type | Description |
|---|---|
OldASError
|
If there was an error connecting or logging in. |
post
async
Make a POST call to the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The URL to call. |
required |
|
Any
|
The data to pass. |
{}
|
Returns:
| Type | Description |
|---|---|
RawData
|
The response from the call to the API. |
Raises:
| Type | Description |
|---|---|
OldASError
|
If there was an error connecting or logging in. |