PySkoob Documentation
Welcome to the PySkoob documentation. This site provides usage examples and a reference of the available services.
Installation
pip install pyskoob
Usage
from pyskoob import SkoobClient
with SkoobClient() as client:
books = client.books.search("python").results
API Reference
Client facades bundling synchronous and asynchronous services.
SkoobAsyncClient
Facade for interacting with Skoob services asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_client
|
AsyncHTTPClient | None
|
Optional pre-configured HTTP client implementing :class: |
None
|
rate_limiter
|
RateLimiter | None
|
Optional rate limiter used to throttle requests. When |
None
|
retry
|
Retry | None
|
Optional retry handler for automatically retrying requests on network
errors. Ignored when |
None
|
**client_kwargs
|
Any
|
Additional keyword arguments forwarded to |
{}
|
Source code in pyskoob/client.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
__aexit__(exc_type, exc_val, exc_tb)
async
Exit the async runtime context, closing the HTTPX client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exc_type
|
type[BaseException] | None
|
The exception type. |
required |
exc_val
|
BaseException | None
|
The exception value. |
required |
exc_tb
|
TracebackType | None
|
The traceback object. |
required |
Returns:
| Type | Description |
|---|---|
Literal[False]
|
Always returns |
Source code in pyskoob/client.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
close()
async
Close the underlying HTTP client.
Examples:
>>> client = SkoobAsyncClient()
>>> await client.close()
Source code in pyskoob/client.py
182 183 184 185 186 187 188 189 190 | |
SkoobClient
Facade for interacting with Skoob services.
Examples:
>>> with SkoobClient() as client:
... client.auth.login_with_cookies("token")
Source code in pyskoob/client.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
__enter__()
Enter the runtime context for the SkoobClient.
Returns:
| Type | Description |
|---|---|
SkoobClient
|
The SkoobClient instance. |
Examples:
>>> with SkoobClient() as client:
... pass
Source code in pyskoob/client.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
__exit__(exc_type, exc_val, exc_tb)
Exit the runtime context, closing the HTTPX client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exc_type
|
type[BaseException] | None
|
The exception type. |
required |
exc_val
|
BaseException | None
|
The exception value. |
required |
exc_tb
|
TracebackType | None
|
The traceback object. |
required |
Returns:
| Type | Description |
|---|---|
Literal[False]
|
Always returns |
Examples:
>>> client = SkoobClient()
>>> client.__exit__(None, None, None)
False
Source code in pyskoob/client.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
__init__(rate_limiter=None, retry=None, **kwargs)
Initializes the SkoobClient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rate_limiter
|
RateLimiter | None
|
Optional rate limiter used to throttle requests. If |
None
|
retry
|
Retry | None
|
Optional retry handler for automatically retrying requests on
network errors. If |
None
|
**kwargs
|
Any
|
Additional keyword arguments forwarded to |
{}
|
Source code in pyskoob/client.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
close()
Close the underlying HTTP client.
Examples:
>>> client = SkoobClient()
>>> client.close()
Source code in pyskoob/client.py
105 106 107 108 109 110 111 112 113 | |
Authentication helpers and session management for Skoob.
AsyncAuthService
Bases: _AuthServiceMixin, AsyncBaseSkoobService
Asynchronous authentication service.
Source code in pyskoob/auth.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
get_my_info()
async
Retrieve information about the authenticated user.
Returns:
| Type | Description |
|---|---|
User
|
Authenticated user details. |
Source code in pyskoob/auth.py
245 246 247 248 249 250 251 252 253 254 | |
login(email, password)
async
Log in with email and password.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
Account email address. |
required |
password
|
str
|
Account password. |
required |
Returns:
| Type | Description |
|---|---|
User
|
Authenticated user information. |
Source code in pyskoob/auth.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
login_with_cookies(session_token)
async
Log in using a pre-existing session token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_token
|
str
|
Value of the |
required |
Returns:
| Type | Description |
|---|---|
User
|
Authenticated user information. |
Source code in pyskoob/auth.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
validate_login()
async
Validate that the current session is authenticated.
Raises:
| Type | Description |
|---|---|
PermissionError
|
If the service has not been authenticated yet. |
Source code in pyskoob/auth.py
256 257 258 259 260 261 262 263 264 265 | |
AuthService
Bases: _AuthServiceMixin, BaseSkoobService
Handle authentication with Skoob and track login state.
Source code in pyskoob/auth.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
__init__(client)
Manage Skoob authentication and session validation.
Source code in pyskoob/auth.py
141 142 143 144 145 | |
get_my_info()
Retrieve information about the authenticated user.
Returns:
| Type | Description |
|---|---|
User
|
Authenticated user details. |
Source code in pyskoob/auth.py
181 182 183 184 185 186 187 188 189 190 | |
login(email, password)
Log in with email and password.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
Account email address. |
required |
password
|
str
|
Account password. |
required |
Returns:
| Type | Description |
|---|---|
User
|
Authenticated user information. |
Source code in pyskoob/auth.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
login_with_cookies(session_token)
Log in using a pre-existing session token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_token
|
str
|
Value of the |
required |
Returns:
| Type | Description |
|---|---|
User
|
Authenticated user information. |
Source code in pyskoob/auth.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
validate_login()
Validate that the current session is authenticated.
Raises:
| Type | Description |
|---|---|
PermissionError
|
If the service has not been authenticated yet. |
Source code in pyskoob/auth.py
192 193 194 195 196 197 198 199 200 201 | |