Skip to main content

A Python library for easier and faster downloading.

Project description

persepolis_lib

About

A Python library for easier and faster downloading

Features

  • Multi-segment downloading(64 connections)
  • Resuming downloads

Installation

persepolis_lib is available on pypi.

pip install persepolis-lib

Usage

#!/usr/bin/python3

# import Download class
from persepolis_lib.persepolis_lib import Download

# create a dictionary that contains download infromation.
download_dict = {'link': http://example.com/example.jpg, # your download link
                       'out': None, # You can choose a name for your file if you want. If you don't want to, choose None for its value.
                       'download_path': /home/example_user/Downloads, # Choose download path. You must choose valid download path!
                       'ip': None, # set ip of your proxy, If you don't use proxy, set None value for it.
                       'port': None, # set port of your proxy, If you don't use proxy, set None value for it.
                       'proxy_user': None, # set proxy user, If you don't use proxy, set None value for it.
                       'proxy_passwd': None, # set proxy pass word, If you don't use proxy, set None value for it.
                       'proxy_type': None, # set proxy type, http or socks5. If you don't use proxy, set None value for it.
                       'download_user': None, # set username, If your download link requires user name,Otherwise, set its value to ٔNone.
                       'download_passwd': None, # set password, If your download link requires user name and password,Otherwise, set its value to ٔNone.
                       'header': None, # set header if you want, Otherwise, set its value to ٔNone.
                       'user_agent': None, # set user-agent if you want, Otherwise, set its value to ٔNone. persepolis_lib/version is default user agent.
                       'load_cookies': None, # set cookies path if you want, Otherwise, set its value to ٔNone.
                       'referer': None} # set referrer if you want, Otherwise, set its value to ٔNone.
# persepolis supports Multi-segment downloading. set number of threads. maximum value is 64. minimum value is 1. default is 64.
segments = 64

# set python requests chunk size in KiB.
# checkout this link for more informaton. https://stackoverflow.com/questions/46205586/why-to-use-iter-content-and-chunk-size-in-python-requests
# default is 100 KiB
pytho_requests_chunk_size = 100 # KiB

# create a download session
# set timeout value in seconds. default is 10.
# set number of retries if download failed. default is 5.
# set time for waiting between retries. default is 5.
# set progress_bar value to True If you want the progress bar to be shown in the console. default is False
# set threads_progress_bar to True If you want the size downloaded by each thread to be displayed in the progress bar. default is False.
download_session = Download(add_link_dictionary=download_dict, number_of_threads=segments,
                             chunk_size=pytho_requests_chunk_size, timeout=10, retry=5, retry_wait=5, progress_bar=False, threads_progress_bar=False)
# start download. Use thread if you want!
download_session.start()

# stop download
download_session.stop()

# pause download
download_session.downloadPause()

# Unpause
download_session.downloadUnPause()

# limit download speed.
# limit_value is between 1 to 10.
# 10 means no limit speed.
download_session.limitSpeed(5)

# get download information in dictionary format
status_dict = download_session.tellStatus()
print(status_dict)

persepolis_lib creates download file and log file and conrol file in json format with .persepolis extension in download path. control file contains download information. Persepolis_lib can resume download, If control file exists.

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

persepolis_lib-1.1.2.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

persepolis_lib-1.1.2-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

Details for the file persepolis_lib-1.1.2.tar.gz.

File metadata

  • Download URL: persepolis_lib-1.1.2.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for persepolis_lib-1.1.2.tar.gz
Algorithm Hash digest
SHA256 5636f9cb91ba7807a22be522a67435cee5dfe84176b163c2833561c456d34ba3
MD5 a17d494e78e0f122e0912075a85df861
BLAKE2b-256 e31575fc6fd693bd32e4e613c40ced06da8409b8b894c44859214d40220b9fd2

See more details on using hashes here.

File details

Details for the file persepolis_lib-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: persepolis_lib-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 39.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for persepolis_lib-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ef8b7a281b83cf7ad74d8047042747853c8b2dac8757a421b1914f83af37ef
MD5 b9d3bbf4abff4057d59657eb19d9d6fd
BLAKE2b-256 2d7407327a68c565da831f546c941b72dab6e185c4b7a345056d2e2e9d276372

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page