Pyflit

A simple Python HTTP downloader that support multi-thread downloading and multi-segment file downloading.
Alternatives To Pyflit
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Gopeed7,078
18 hours ago22August 01, 202321gpl-3.0Dart
High speed downloader that supports all platforms. Built with Golang and Flutter.
Fast Android Networking5,536
6 months ago241apache-2.0Java
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
Aria5,341
a month ago148apache-2.0Java
下载可以很简单
Prdownloader3,164
8 months ago3December 08, 2020116apache-2.0Java
PRDownloader - A file downloader library for Android with pause and resume support
M3u8 Downloader2,651
2 months ago26JavaScript
M3U8-Downloader 支持多线程、断点续传、加密视频下载缓存。
Fetch1,51435 months ago3September 05, 201991apache-2.0Java
The best file downloader library for Android
Pget1,05116 days ago3January 06, 20224mitGo
The fastest, resumable file download client
Cc Attack705
4 months ago25gpl-2.0Python
Using Socks4/5 or http proxies to make a multithreading Http-flood/Https-flood (cc) attack.
Gradle Download Task625641114 days ago34May 04, 20229apache-2.0Java
📥 Adds a download task to Gradle that displays progress information
Sasila264
4 years ago17December 13, 20171apache-2.0Python
一个灵活、友好的爬虫框架
Alternatives To Pyflit
Select To Compare


Alternative Project Comparisons
Readme

README

Pyflit is a simple Python HTTP downloader. The features it supports are shown below.

Features

  • HTTP GET
  • multi-threaded fetch multiple URLs
  • multi-segment file fetch
  • gzip/deflate/bzip2 compression supporting
  • a simple progress-bar
  • download pause and resume
  • proxy supporting

Don't use this package in production!

This package is not well tested and buggy that should not be used in production!

Simple Tutorial

HTTP GET

First, get self defined URL opener object, you can specify some handlers to support cookie, authentication and other advanced HTTP features. If you want change the User-Agent or add Referer in the HTTP request headers, you can also given a self defined headers as argument. And more, you can turn on proxy by given a dictionary of proxy address. See the API reference for details.

Example:

handlers = [cookie_handler, redirect_handler]
headers = {'User-Agent': 'Mozilla/5.0 '
           '(Macintosh; Intel Mac OS X 10_9_4) '
           'AppleWebKit/537.77.4 (KHTML, like Gecko) '
           'Version/7.0.5 Safari/537.77.4'}
proxies = {'http': 'http://someproxy.com:8080'}

opener = flit.get_opener(handlers, headers, proxies)
u = opener.open("http://www.python.org")
resp = u.read()

Multiple URLs fetching

You can just call flit.flit_tasks() to fetch multiple URLs with specified working thread number, a generator will be returned and you can iterate it to process the data chunks.

Example:

from pyflit import flit

def chunk_process(chunk):
    """Output chunk information.
    """
    print "Status_code: %s\n%s\n%s \nRead-Size: %s\nHistory: %s\n" % (
        chunk['status_code'],
        chunk['url'],
        chunk['headers'],
        len(chunk['content']),
        chunk.get('history', None))

links = ['http://www.domain.com/post/%d/' % i for i in xrange(100, 200)]
thread_number = 5
opener = flit.get_opener([handlers [, headers [, proxies]]])
chunks = flit.flit_tasks(links, thread_number, opener)
for chunk in chunks:
    chunk_process(chunk)

Multiple segment file downloading

Multiple segment file downloading use multiple thread to download the separated part of the URL file, you can simply give two arguments: URL address and the segment number.

Example:

from pyflit import flit

url = "http://www.gnu.org/software/emacs/manual/pdf/emacs.pdf"
segment_number = 2
opener = flit.get_opener([handlers [, headers [, proxies]]])
flit.flit_segments(url, segment_number, opener)

Contributing

You can send pull requests via GitHub or help fix the bugs in the issues list.

Popular Downloader Projects
Popular Http Projects
Popular Networking Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Python
Http
Proxy
Thread
Fetch
Downloader