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.1.2.tar.gz (26.8 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.1.2-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: seedr_api_client-0.1.2.tar.gz
  • Upload date:
  • Size: 26.8 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.1.2.tar.gz
Algorithm Hash digest
SHA256 aa8a0e10eb2a10f6489ced01aba7c9155089e14e62ab08e8c6e34600d2cf6d8a
MD5 313011b4406d607d7153833505701067
BLAKE2b-256 6e198cc0d1e25491226888ba11d67c4c9acbacb9acb60f643fcbc0d5a9a9f887

See more details on using hashes here.

Provenance

The following attestation bundles were made for seedr_api_client-0.1.2.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.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for seedr_api_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f55a4ac46b86eee485137c11d2c616c8973e4c675d25bf3af9ba00d3a25a4302
MD5 e4c5d9b91ff6db2ec7ed7ec7b438828f
BLAKE2b-256 ec1a1b1a587e1467a34669d70ab775acaf5fb0b9a925d9d8a296fe7be96265f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for seedr_api_client-0.1.2-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