项目作者: halilozercan

项目描述 :
Fast download in chunks
高级语言: Python
项目地址: git://github.com/halilozercan/pget.git
创建时间: 2016-05-30T12:42:19Z
项目社区:https://github.com/halilozercan/pget

开源协议:Apache License 2.0

下载


Deprecated

I abandoned this project almost 3 years ago when I also stopped using Python. Please use tools like curl, aria2, wget for file downloads using CLI.
Also consider using requests library as a Python package alternative.

PGet

pget offers a simple yet functional API that enables you to save large files from bandwidth limited servers such as Google Drive, Yandex Disk, etc.

Basically, Downloader operates asynchronously and creates multithreads that connect to specified url from different ranges.

How to get

You can install pget from PyPI using pip

  1. pip install pget

Also you can clone this repository and install it using setuptools

  1. git clone https://github.com/halilozercan/pget
  2. cd pget
  3. python setup.py install

Usage

Pget is essentially designed to be a python module, but it also provides a nice executable to cater your download needs quickly.

  1. PGet - A tool for fast downloads
  2. positional arguments:
  3. http://filedownload.url/path?args=given
  4. File URL
  5. filename.txt File name
  6. optional arguments:
  7. -h, --help show this help message and exit
  8. --chunks CHUNKS, -C CHUNKS
  9. Chunk count

This is the output of well-known argument parser of python. For example

  1. pget "http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4" bunny.mp4 -C 8

In this example, we download big buck bunny video to bunny.mp4 file from 8 different ranges.

If we want to do this in a python code

  1. from pget.down import Downloader
  2. downloader = Downloader(url, filename, chunk_count)
  3. downloader.start()
  4. downloader.subscribe(callback, callback_threshold)
  5. downloader.wait_for_finish()
  • by using subscribe, we get a callback from downloader whenever callback_threshold kilobytes of data is downloaded.
  • start and wait_for_finish is like starting a thread and waiting to join. You can also run pget downloader in sync mod by start_sync()
  • During the download, downloader object is updated regularly. So you can use it to get feedback in your application.