A Python Asynchronous Downloader - pyaiodl
Project description
Python Asynchronous Downloader - pyaoidl
Don't Use it in Production or Live Projects Currently Its Unstable
Version
installation
pypi Method (recommanded)
pip3 install pyaiodl
Github repo method
pip3 install git+https://github.com/aryanvikash/pyaiodl.git
Avalible Methods
-
Downloader class Instance
Non-blocking , params = [fake_useragent:bool,chunk_size:int ,download_path:str] optinalsdl = Downloader() -
Download [
download(self.url)]uuid = await dl.download(url) -
cancel [
cancel(self, uuid)]await dl.cancel(uuid) -
Get Status [
status(self, uuid)]response = await dl.status(uuid) returns a dict """ filename:str file_type :str total_size :int total_size_str : str downloaded :int downloaded_str :str progress:int download_speed:str active: bool complete :bool download_path:str """ -
is_active returns : bool [
is_active( self,uuid )]on cancel and download complete it will return Falseresult = await dl.is_active(uuid)
Usage
Example :
import asyncio
from pyaiodl import Downloader
url = "https://speed.hetzner.de/100MB.bin"
async def main(url):
dl = Downloader()
try:
#Non-blocking
uuid = await dl.download(url)
#progress
while await dl.is_active(uuid):
r = await dl.status(uuid)
#cancel
# await dl.cancel(uuid)
print(f"""
Filename: {r['filename']}
Total : {r['total_size_str']}
Downloaded : {r['downloaded_str']}
Download Speed : {r['download_speed']}
progress: {r['progress']}
""")
await asyncio.sleep(1)
# Final filename / path
print( "download completed : ",r['download_path'])
except Exception as e:
print(e)
asyncio.get_event_loop().run_until_complete(main(url))
known Bugs -
- Error is Not Handled Correctly
TODO
- Multipart Download
- Queue Download / Pararrel Download Limit
- Better Error Handling
Thanks ❤️
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
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 pyaiodl-0.0.2.tar.gz.
File metadata
- Download URL: pyaiodl-0.0.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2142499d71048d1949d81b0faa2159605e9657941ea814c764e77e0082984da8
|
|
| MD5 |
c4d0a438809285b40f5c538145d70132
|
|
| BLAKE2b-256 |
38507dfd93fed05e40ac4d8f3c93cff7563054e2ab28bb0afa9828e2fde576af
|
File details
Details for the file pyaiodl-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pyaiodl-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c83a8fb852bc27180eeb6efc5675b194f97d42e05c96b127e773c6b8ad26c39
|
|
| MD5 |
5f1a149cda8c399b73666aed001609c9
|
|
| BLAKE2b-256 |
9e7eb89cafea77c9715a9251e5a19d6a7d68219a02d3384d5259ae36e6b74674
|