Skip to main content

pypi license

img1

Table of contents:

Introduction

dlbar is a simple terminal progress bar for downloading and displaying download progress.

You can use this module to download files and display the download progress bar in your Python projects.

Installation

You can use pip to install:

python3 -m pip install dlbar

How to use dlbar?

To use the dlbar module, you must import it:

from dlbar import DownloadBar

download_bar = DownloadBar()

download_bar.download(
    url='https://url',
    dest='/a/b/c/downloaded_file.suffix',
    title='Downloading downloaded_file.suffix'
)

Output:

Downloading downloaded_file.suffix
43% █████████████████████----------------------------- 197.777 MB/450.327 MB

Customize the download bar

You have many options to customize your download bar.

Pay attention to the following example on how to change the characters of the download bar:

from dlbar import DownloadBar

download_bar = DownloadBar(
    empty_char='.',
    filled_char='>'
)

download_bar.download(
    url='https://url',
    dest='/a/b/c/downloaded_file.suffix',
    title='Downloading downloaded_file.suffix'
)

Output:

Downloading downloaded_file.suffix
63% >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>................... 284.590 MB/450.327 MB

You can even use ANSI codes to color the download bar characters:

from dlbar import DownloadBar

download_bar = DownloadBar(
    empty_char=f"\033[31m{chr(9472)}\033[0m",
    filled_char=f"\033[32m{chr(9472)}\033[0m"
)

download_bar.download(
    url='https://url',
    dest='/a/b/c/downloaded_file.suffix',
    title='Downloading downloaded_file.suffix'
)

Output: img1

You can also change the width of the download bar (any number greater than or equal to 10 is valid):

from dlbar import DownloadBar

download_bar = DownloadBar(width=35)

download_bar.download(
    url='https://url',
    dest='/a/b/c/downloaded_file.suffix',
    title='Downloading downloaded_file.suffix'
)

Output:

Downloading downloaded_file.suffix
12% ████------------------------------- 54.512 MB/450.327 MB

You can even hide the percentage or progress status of the download:

from dlbar import DownloadBar

download_bar = DownloadBar(percent=False)

download_bar.download(
    url='https://url',
    dest='/a/b/c/downloaded_file.suffix',
    title='Downloading downloaded_file.suffix'
)

Output:

Downloading downloaded_file.suffix
█████████████████████----------------------------- 197.777 MB/450.327 MB

You can also deal with attributes in the form of properties and change their values after creating an instance:

from dlbar import DownloadBar

download_bar = DownloadBar()

download_bar.status = False
download_bar.filled_char = '#'

download_bar.download(
    url='https://url',
    dest='/a/b/c/downloaded_file.suffix',
    title='Downloading downloaded_file.suffix'
)

Output:

Downloading downloaded_file.suffix
43% #####################-----------------------------

Contribution

dlbar is a free and open source project under the MIT license. You can easily use dlbar and contribute if you have an idea for development.

Thank you

Release files for dlbar 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dlbar 1.0.0
File Size Uploaded
dlbar-1.0.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlbar 1.0.0
File Interpreter ABI Platform
dlbar-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size:11.4 kB

Release files / dlbar-1.0.0.tar.gz

Download URL dlbar-1.0.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
985de3b3efbb1d33970d632851887fbb7ed198d577a71b3edc38d4ac66e64b4f
BLAKE2b-256 checksum
How to use checksums
8bacbf1867309ed80eed244793ae893e80fcadf83e003c155c85bd6909a6117b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / dlbar-1.0.0-py3-none-any.whl

Download URL dlbar-1.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25c3be3262242e0eb81b8f25b435ddfef9cb2ad39fc1636bfdd5e445a43ed63f
BLAKE2b-256 checksum
How to use checksums
e1894451de36ed6d1a15a56db354fd20480a67fd84533e8c682b1c907e8afab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page