You can install TechZDL using pip:
pip install techzdl
To update TechZDL to the latest version, use:
pip install --upgrade techzdl
Note: If it doesn't update to the latest version, use:
pip install --upgrade --force-reinstall techzdl
Here's a basic example of how to use the TechZDL package:
import asyncio
from techzdl import TechZDL
async def main():
downloader = TechZDL(url="https://link.testfile.org/bNYZFw")
await downloader.start()
asyncio.run(main())
TechZDL.Demo.Usage.mp4
You can import it using:
from techzdl import TechZDL
Here is a list of arguments you can pass to the TechZDL
class to modify your downloading process:
url
(str)
: URL of the file to download.custom_headers
(Optional[dict])
: Custom headers to send with the request. Defaults to None.output_dir
(Union[str, Path])
: Directory where the file will be saved. Defaults to "downloads".filename
(Optional[str])
: Name to save the file as (including extension). By default, this will be determined automatically.workers
(Optional[int])
: Number of fixed concurrent download workers. By default, this will be dynamically adjusted based on the download speed. Setting this will disable dynamic worker adjustment.initial_dynamic_workers
(int)
: Initial number of dynamic workers. Defaults to 2.dynamic_workers_update_interval
(int)
: Interval in seconds to update dynamic worker count. Defaults to 5.debug
(bool)
: Enable debug logs. Defaults to True.progress
(bool)
: Enable download progress display. Defaults to True.progress_callback
(Optional[Callable[..., Any]])
: Callback function for download progress updates. Can be synchronous. Defaults to None. Setting this disables tqdm progress.progress_args
(tuple)
: Additional arguments forprogress_callback
. Defaults to ().progress_interval
(int)
: Time interval for progress updates in seconds. Defaults to 1.chunk_size
(int)
: Size of each download chunk in bytes. Defaults to 5 MB.single_threaded
(bool)
: Force single-threaded download. Defaults to False.max_retries
(int)
: Maximum retries for each chunk/file download. Defaults to 3.
id
(str)
: A unique identifier for the TechZDL downloader object, generated at the time of object creation.is_running
(bool)
: Indicates if the download process is currently running.True
if the process is active, otherwiseFalse
.filename
(str)
: The name of the downloaded file. Can be accessed after downloading starts.output_path
(Path)
: The file path where the downloaded file is stored. Can be accessed after downloading starts.
Note:
Path
refers to thePath
object from thepathlib
library.
from pathlib import Path
download_success
(bool)
:True
if the file was downloaded successfully, otherwiseFalse
. Can be accessed after downloading completes or fails.download_error
(Exception or None)
: Contains the exception if an error occurred during the download process, otherwiseNone
. Can be accessed after downloading completes or fails.
Note: The attributes
output_path
,download_success
, anddownload_error
are particularly useful when using the background download mode, as errors raised and the file path cannot be directly accessed.
import asyncio
from techzdl import TechZDL
async def main():
downloader = TechZDL(url="https://link.testfile.org/bNYZFw")
print(downloader.id)
print(downloader.is_running)
asyncio.run(main())
Note: While you can access the above attributes, modifying them directly is not recommended as it may cause issues with the downloader object.
import asyncio
from techzdl import TechZDL
async def main():
downloader = TechZDL(url="https://link.testfile.org/bNYZFw")
print(downloader.id)
print(downloader.is_running)
asyncio.run(main())
Note: While you can access the above attributes, modifying them directly is not recommended as it may cause issues with the downloader object.
Starts the download process.
in_background
(bool, optional)
: Run the download process in the background. Defaults to False.
filepath
(Path)
: Path to the downloaded file.
Forcefully stops the download process.
Fetches file information from the server.
-
dict
: File information in the format{"filename": str, "total_size": int}
.filename
(str)
: Name as returned by the server or determined by the TechZDL package using response headers and download URL.total_size
(int)
: Total size of the file in bytes.
For inquiries or support, join our Telegram Support Group or email [email protected].
- Join our Telegram Channel