Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aioxdl

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aioxdl

Python fast downloader

  • 0.0.30
  • PyPI
  • Socket score

Maintainers
1

📦 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())

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc