Python client for the Skoob website handling authentication and HTML parsing
Project description
PySkoob
PySkoob is a Python client that makes it easy to interact with the Skoob website. It takes care of authentication and HTML parsing so you can focus on your automation or data collection tasks.
Features
- Search books by title, author or ISBN
- Retrieve detailed book information and reviews
- Access user profiles and reading statistics
- Authenticate using email/password or an existing session cookie
Services
Documentation for each service is available on GitHub Pages:
Installation
Install the latest release from PyPI:
python -m pip install pyskoob
Or install the bleeding edge version from GitHub:
python -m pip install git+https://github.com/victor-soeiro/pyskoob.git
Authentication
You can authenticate in two different ways:
-
Email and password
from pyskoob import SkoobClient with SkoobClient() as client: me = client.auth.login(email="you@example.com", password="secret")
-
Session cookie
from pyskoob import SkoobClient with SkoobClient() as client: me = client.auth.login_with_cookies("PHPSESSID_TOKEN")
Once authenticated you can access all other services.
Usage example
Search for books
from pyskoob import SkoobClient
from pyskoob.models.enums import BookSearch
with SkoobClient() as client:
results = client.books.search("Harry Potter", BookSearch.TITLE)
for book in results.results:
print(book.title, book.book_id)
Fetch book details
from pyskoob import SkoobClient
with SkoobClient() as client:
book = client.books.get_by_id(1) # replace with a real edition ID
print(book.title, book.publisher.name)
Authenticate and access your profile
from pyskoob import SkoobClient
with SkoobClient() as client:
# TIP: use environment variables or a secrets manager instead of hard-coding credentials
me = client.auth.login(email="you@example.com", password="secret")
print(me.name)
Rate limiting
Skoob may block clients that issue too many requests in a short period of
time. PySkoob includes a basic rate limiter that throttles requests to one
per second by default. Adjusting this limit is possible but done entirely at
your own risk—Skoob may block or ban your account. Provide a custom
:class:pyskoob.utils.RateLimiter instance to change or disable the limit:
from pyskoob import RateLimiter, SkoobClient
limiter = RateLimiter(max_calls=2, period=1) # two requests per second (use at your own risk)
with SkoobClient(rate_limiter=limiter) as client:
...
SkoobAsyncClient accepts the same configuration options and forwards any
extra keyword arguments to httpx.AsyncClient. You may also provide a
pre-configured HTTP client or manage the lifecycle manually using the explicit
close method:
from pyskoob import RateLimiter, SkoobAsyncClient
from pyskoob.http.httpx import HttpxAsyncClient
limiter = RateLimiter(max_calls=2, period=1)
http_client = HttpxAsyncClient(rate_limiter=limiter, timeout=5)
client = SkoobAsyncClient(http_client=http_client)
try:
...
finally:
await client.close()
Running tests
Install the project in editable mode and run the test suite:
uv pip install -e .[dev]
pytest -vv
Contributing
Before working on new features, set up a local development environment:
# Install uv if it's not already available
python -m pip install uv
# Create and activate a virtual environment
uv venv .venv
source .venv/bin/activate
# On Windows
.\.venv\Scripts\activate
# Install the project with development dependencies
uv pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
# Verify linting, formatting, and tests
pytest -vv
pre-commit run --all-files
Once everything is ready:
-
Fork the repository and create a branch for your feature.
-
Implement your change and add tests.
-
Format your code with Ruff:
ruff format .
-
Ensure lint checks pass:
ruff check .
-
Run
pytest -vvandpre-commit run --all-filesand ensure everything passes. -
Open a pull request describing your changes.
Learn more
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyskoob-0.2.0.tar.gz.
File metadata
- Download URL: pyskoob-0.2.0.tar.gz
- Upload date:
- Size: 45.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce33c468c6971c108a9f5d063fa8966abcf0e2b06295980cd9fb82efe4556688
|
|
| MD5 |
d61746da7617abaae1f6580f76ee5492
|
|
| BLAKE2b-256 |
667c74be4d9c7136b95120e06ad16a0b45c7d25bb1362a127e349adf2ef1af74
|
File details
Details for the file pyskoob-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyskoob-0.2.0-py3-none-any.whl
- Upload date:
- Size: 46.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74a551eacdcee29fec77c5721c9c656ace12b555ed08c3c6be8adcbf0940bd0d
|
|
| MD5 |
e6d8345dc4345f40316e98ed341c6728
|
|
| BLAKE2b-256 |
9afed9d11d42e1c0bbc0dcdeee50a2434f04da4ae4ed3eeea8a193c46d917cb6
|