Git Product home page Git Product logo

nbdler's Introduction

Nbdler

Build Status Build Status

Nbdler 是由Python3 编写的异步多客户端、多来源下载工具。

支持协议

  • HTTP
  • HTTPS

支持客户端

  • aiohttp: Async http client/server framework.
  • requests: A simple, yet elegant HTTP library.

特征

  • 支持断点续传
  • 支持多来源多客户端下载
  • 支持速度限速
  • 支持下载缓冲设置
  • 支持代理(取决于客户端)

入门使用

简单下载示例

import asyncio
import nbdler

async def main():
    request = nbdler.Request('http://a/file', file_path='file')
    async with nbdler.dlopen(request) as dl:
        dl.start()
        while not dl.is_finished():
            print((f'filename={dl.file.name}, '
                   f'transfer rate={round(dl.transfer_rate() / 1024)} kb/s, '
                   f'{round(dl.percent_complete(), 2)} % percent complete'))    
            await asyncio.sleep(1)
        await dl.ajoin()
            
asyncio.run(main())

多客户端,多来源,指定处理客户端,指定最大并发数

import asyncio
import nbdler

async def main():
    request = nbdler.Request('http://a/file', 
                client_policy=nbdler.get_policy(http='aiohttp', https='requests'), 
                max_concurrent=16, file_path='file')
    request.put('https://b/file')
    async with nbdler.dlopen(request) as dl:
        await dl.astart()
        await dl.ajoin()
            
asyncio.run(main())

关于方法

Installation

$ pip install Nbdler

Requirements

  • Python >= 3.5.3
  • aiohttp
  • requests

许可证

Apache-2.0

TODO

  • 完善使用文档。
  • 实现Handler处理器(SampleValidate 保证多来源下载时的资源匹配)。
  • 实现DownloadSession(以便实现下载器的进程隔离,同时实现RPC进程通信)。
  • 支持FTP协议。

nbdler's People

Contributors

zsaim avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.