Skip to main content

Python fast downloader

Project description

📦 AIO DOWNLOADER

telegram badge telegram badge telegram badge

INSTALLATION

pip install aioxdl

USAGE

import time
import asyncio
from aioxdl.modules import Aioxdl
from aioxdl.modules import Filename

async def progress(tsize, dsize, stime):
    # stime = start_time
    # tsize = total_size
    # dsize = download_size
    percentage = round((dsize / tsize) * 100, 2)
    print("\rCOMPLETED : {}%".format(percentage), end="", flush=True)

async def main():
    core = Aioxdl(timeout=2000)
    link = "https://example.link/file.txt"
    loca = await Filename.filename(link)
    file = await core.download(link, loca.result, progress=progress, progress_args=(time.time()))
    fine = file.result if file.errors == None else file.errors
    print(fine)

asyncio.run(main())

GET FILENAME

from aioxdl.modules import Filename

async def main():
    link = "https://example.link/file.txt"
    name = await Filename.get(link)
    print(name.result)

asyncio.run(main())

STOP DOWNLOAD

import time
import asyncio
from aioxdl.modules import Aioxdl
from aioxdl.modules import Filename
from aioxdl.functions import Cancelled

TASK_ID = []

async def progress(tsize, dsize, stime, tuid):
    # stime = start_time
    # tsize = total_size
    # dsize = download_size
    if tuid in TASK_ID:
        percentage = round((dsize / tsize) * 100, 2)
        print("\rCOMPLETED : {}%".format(percentage), end="", flush=True)
    else:
        raise Cancelled("Cancelled ❌")

async def main():
    tims = time.time()
    tuid = 1234567890
    TASK_ID.append(tuid)
    core = Aioxdl(timeout=2000)
    link = "https://example.uri/file.txt"
    loca = await Filename.filename(link)
    file = await core.download(link, loca.result,
                               progress=progress, progress_args=(tims, tuid))
    if file.status == 400:
        print(file.errors)
    elif file.status == 300:
        print("Cancelled ❌")
    else:
        print(fine.result)

asyncio.run(main())

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

aioxdl-0.0.30.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

aioxdl-0.0.30-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file aioxdl-0.0.30.tar.gz.

File metadata

  • Download URL: aioxdl-0.0.30.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for aioxdl-0.0.30.tar.gz
Algorithm Hash digest
SHA256 fb489e1ec93480d76cfbf72cc19b8c39eea7b2a36fff86a8a438f6ef2a52d78b
MD5 2e3e7249df906a4730f00f7d52db45b4
BLAKE2b-256 ac4ee144394e16430f744b1d074812bdfd1170d64a6589991bcd378fa6cb9a14

See more details on using hashes here.

File details

Details for the file aioxdl-0.0.30-py3-none-any.whl.

File metadata

  • Download URL: aioxdl-0.0.30-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for aioxdl-0.0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 8cd9e443424a410fb335965a334ed46b77ec6c8d8dd62d6cf7d9655510e64813
MD5 bafae53024d0a4715785753755e483b8
BLAKE2b-256 ae3e1f7228bec51866fa5f449021af32bbad55f1be69bf4b38e2c82cb641005d

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