Skip to content

tinnguyentg/aiodownloads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aiodownloads

Asynchronous downloads

Installation

pip install aiodownloads

Usage

Inherit aiodownloads.Downloader then override handle_success, handle_fail methods

Examples

  • Download list of urls
import asyncio

from aiodownloads import Downloader

urls = [
    'https://httpbin.org/status/200',
    'https://httpbin.org/status/400'
]
class UrlsDownloader(Downloader):

    async def handle_success(self, resp, item):
        content = await resp.read()
        # save content stuff

    async def handle_fail(self, resp, item):
        ...

url_downloader = UrlsDownloader()
asyncio.run(url_downloader.download(urls))

About

Asynchronous downloads

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages