Skip to main content

Debrid Manager Python package

Project description

Yuumi

Yuumi is a Python package that allows you to use multiple debrid services in your Python projects.

Installation

poetry add Yuumi

or

pip install Yuumi

Usage

from Yuumi.debrid import RealDebridAPI

api = RealDebridAPI("your_access_token")

# Get user info
user_info = await api.get_user_info()
print(user_info)

# Check instant availability
instant_availability = await api.get_instant_availability("2f5a5ccb7dc32b7f7d7b150dd6efbce87d2fc371")
print(instant_availability)

# Download a file
download = await api.add_magnet("magnet:?xt=urn:btih:2f5a5ccb7dc32b7f7d7b150dd6efbce87d2fc371")
print(download)

Download Example

import asyncio
from yuumi.debrid import RealDebridAPI

async def main():
    api = RealDebridAPI("your_access_token")

    # Example: Downloading a cached torrent
    torrent_hash = "your_torrent_hash"
    availability = await api.get_instant_availability(torrent_hash)
    if availability:
        magnet_link = "your_magnet_link"
        torrent_info = await api.add_magnet(magnet_link)
        torrent_id = torrent_info["id"]
        await api.select_torrent_files(torrent_id, "all")
        print("Files selected and ready for download.")
    else:
        print("Torrent is not cached.")

    # Example: Downloading a non-cached torrent
    magnet_link = "your_magnet_link"
    torrent_info = await api.add_magnet(magnet_link)
    torrent_id = torrent_info["id"]
    print("Torrent added. Waiting for it to be cached...")

    # Timeout mechanism: Give up after 5 minutes (300 seconds)
    timeout = 300
    start_time = asyncio.get_event_loop().time()

    while True:
        torrent_status = await api.get_torrent_info(torrent_id)
        if torrent_status["status"] == "downloaded":
            await api.select_torrent_files(torrent_id, "all")
            print("Files selected and ready for download.")
            break
        if asyncio.get_event_loop().time() - start_time > timeout:
            print("Timeout reached. Torrent is not cached. Giving up.")
            break
        await asyncio.sleep(30)  # Wait for 30 seconds before checking again

# Run the main function
asyncio.run(main())

CLI Usage

yuumi --token YOUR_ACCESS_TOKEN --user

More information can be found here:

yuumi --help

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

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

yuumi-0.2.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

yuumi-0.2.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file yuumi-0.2.1.tar.gz.

File metadata

  • Download URL: yuumi-0.2.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for yuumi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 29aa4dc3af73f95ab4f8c033ce746d846d1b18b767567a85a54fdbe23c89057b
MD5 87c27b7c0f588b4576e10186c7ef4952
BLAKE2b-256 96b912f303036f7b4e51f00f8b5e51b9dd6d9979cd8a736f6b29aab119248674

See more details on using hashes here.

File details

Details for the file yuumi-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: yuumi-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for yuumi-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e4e945bd52c1f6d7af07522888dd3689371c337021a98167ab1dd6a1c2c7b36
MD5 24213214f4500728c54a6072ff6bbce0
BLAKE2b-256 0085f5ab2cc1d873f1d00722c7ca9d043d291093831230a1afa94598f1077846

See more details on using hashes here.

Supported by

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