Python fast downloader
Project description
📦 AIOXDL
USAGE
Installation
pip install aioxdl
Quick start
import asyncio
from aioxdl.modules import Aioxdl
from aioxdl.functions import AioxdlTimeout
# tsize = total size
# dsize = downloaded size
async def progress(tsize, dsize):
percentage = round((dsize / tsize) * 100, 2)
print(f"COMPLETED : {percentage}%")
async def main():
try:
core = Aioxdl(timeout=2000)
link = "https://example.in/file.txt"
file = await core.download(link, progress=progress)
print(file)
except AioxdlTimeout as errors:
print(errors)
except Exception as errors:
print(errors)
asyncio.run(main())
Set location
import asyncio
from aioxdl.modules import Aioxdl
from aioxdl.functions import AioxdlTimeout
# tsize = total size
# dsize = downloaded size
async def progress(tsize, dsize):
percentage = round((dsize / tsize) * 100, 2)
print(f"COMPLETED : {percentage}%")
async def main():
try:
path = "/Downloads"
core = Aioxdl(timeout=2000)
link = "https://example.in/file.txt"
file = await core.download(link, location=path, progress=progress)
print(file)
except AioxdlTimeout as errors:
print(errors)
except Exception as errors:
print(errors)
asyncio.run(main())
Set filename
import asyncio
from aioxdl.modules import Aioxdl
from aioxdl.functions import AioxdlTimeout
# tsize = total size
# dsize = downloaded size
async def progress(tsize, dsize):
percentage = round((dsize / tsize) * 100, 2)
print(f"COMPLETED : {percentage}%")
async def main():
try:
name = "Clinton Abraham"
core = Aioxdl(timeout=2000)
link = "https://example.in/file.txt"
file = await core.download(link, filename=name, progress=progress)
print(file)
except AioxdlTimeout as errors:
print(errors)
except Exception as errors:
print(errors)
asyncio.run(main())
Stop download
import asyncio
from aioxdl.modules import Aioxdl
from aioxdl.functions import Cancelled
from aioxdl.functions import AioxdlTimeout
TASK_IDS = []
# tsize = total size
# dsize = downloaded size
async def progress(tsize, dsize, tuid):
if tuid in TASK_IDS:
percentage = round((dsize / tsize) * 100, 2)
print(f"COMPLETED : {percentage}%")
else:
raise Cancelled("Cancelled ❌")
async def main():
try:
tuid = 1234567890
TASK_IDS.append(tuid)
core = Aioxdl(timeout=2000)
link = "https://example.in/file.txt"
file = await core.download(link, progress=progress, progress_args=(tuid))
print(file)
except AioxdlTimeout as errors:
print(errors)
except Cancelled as cancelled:
print(cancelled)
except Exception as errors:
print(errors)
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
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.31.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aioxdl-0.0.31.tar.gz.
File metadata
- Download URL: aioxdl-0.0.31.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec992629f5d053360853a8306e909bd2629afe04a985216c8e1837f4240e2163
|
|
| MD5 |
acb2d9961a75c9797a1b941a2297f345
|
|
| BLAKE2b-256 |
9e40fb4fd28e011019873f88465e70a863aea239c13acbddb558ae882809d5f2
|
File details
Details for the file aioxdl-0.0.31-py3-none-any.whl.
File metadata
- Download URL: aioxdl-0.0.31-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5402f4d860fad2ad0c44d2a1e423879298ea84eb9af64a5b7c5177be10f415cf
|
|
| MD5 |
39df292207056129151de6a82899a577
|
|
| BLAKE2b-256 |
ec12f62148a35b01cd67948e3ccac029d73d9986923cf911b00b206e49300d61
|