Skip to main content

An async Python client library for the Seedr API.

Project description

seedr-api-client

PyPI Python License: MIT CI

An async Python client library for the Seedr API (v0.1).

Features

  • Fully async — built on aiohttp
  • Typed — Pydantic v2 models, py.typed, mypy --strict compliant
  • Dual auth — OAuth 2.0 tokens or email/password
  • Streaming downloads — memory-efficient AsyncGenerator interface
  • Modular — resources split by domain (filesystem, tasks, media, etc.)
  • PEP standards — modern packaging with hatchling

Installation

pip install seedr-api-client

Quick Start

With an OAuth access token

import asyncio
from seedr_api import SeedrClient

async def main() -> None:
    async with SeedrClient.from_token("your-access-token") as client:
        # List root folder
        root = await client.filesystem.list_root_contents()
        print(root)

        # Add a magnet link
        task = await client.tasks.add_magnet("magnet:?xt=urn:btih:...")
        print(task)

        # Stream a file download
        async with client.downloads.stream_file(file_id=123) as stream:
            with open("output.mkv", "wb") as f:
                async for chunk in stream:
                    f.write(chunk)

asyncio.run(main())

With email & password

async with SeedrClient.from_credentials("you@example.com", "password") as client:
    user = await client.user.get()
    print(user.username, user.email)

Resources

Resource Accessor Description
OAuth client.auth Token management, device code flow
User client.user Profile, quota, settings
Filesystem client.filesystem Folders, files, batch operations
Tasks client.tasks Torrent tasks (add, pause, resume, delete)
Downloads client.downloads Stream files, get download URLs
Presentations client.presentations Streaming URLs, thumbnails, playlists
Subtitles client.subtitles List, upload, search OpenSubtitles
Search client.search Search library, scrape for magnets

Device Code Flow (CLI apps)

async with SeedrClient.from_credentials("", "") as client:
    device = await client.auth.request_device_code(client_id="your-client-id")
    print(f"Visit {device.verification_uri} and enter code: {device.user_code}")

    # Poll until user authorizes
    token = await client.auth.poll_device_token(
        client_id="your-client-id",
        device_code=device.device_code,
        interval=device.interval,
    )
    print(f"Access token: {token.access_token}")

Error Handling

from seedr_api.exceptions import NotFoundError, RateLimitError, AuthenticationError

try:
    await client.filesystem.get_file(file_id=999)
except NotFoundError:
    print("File not found")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except AuthenticationError:
    print("Invalid credentials or expired token")

License

MIT © 2024

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seedr_api_client-0.2.0.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seedr_api_client-0.2.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file seedr_api_client-0.2.0.tar.gz.

File metadata

  • Download URL: seedr_api_client-0.2.0.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for seedr_api_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a5d3e11979122f0a2e1d0114eb4486a1691f67b7c8a5836873ec878e3208c76b
MD5 f9336fdcb2fe9a26eb5befc0f0dbd086
BLAKE2b-256 718b31f2d3a205e2fe448e0897e12a81de878c5118e6062af30c534c21df9d32

See more details on using hashes here.

Provenance

The following attestation bundles were made for seedr_api_client-0.2.0.tar.gz:

Publisher: publish.yml on Ns-AnoNymouS/seedr-api-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file seedr_api_client-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for seedr_api_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c3aa4d732a745647c9e73cfe251df61f9386439b22bb52e116a77cf0276ead2
MD5 7917c38ad357ce772dc2b32f86c8051d
BLAKE2b-256 bf240d7dcebc4966ac7fd72d6469bc8fe042ae6728046f6d48466cc496eba5f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for seedr_api_client-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Ns-AnoNymouS/seedr-api-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page