I am writing a python script that uses requests module to download the latest release of geckodriver.exe for windows 64-bit, I added a few functions to make the download slightly more dynamic by identifying the OS type and the system architecture, and after downloaded unzip the package into the defined path I specified.
The current script only downloads geckodriver for windows, this is a precursor for my future work to include downloads for machintosh and linux, hence the OS type function still identifies linux and mac other than windows.
The following is the breakdown of what the functions do:
- init_log – Initializes the logger, instead of using print function to track what the script is doing logger is used. The logs are displayed on stderr to highlight the progress of the script.
- os_architecture – Identifies whether the system is 32 or 64-bit and returns a string.
- os_type – Identifies the OS used for the system.
- get_latest_dl_link – Gets the download link of the latest geckodriver for windows.
- download_gecko_for_win – Downloads the geckodriver package.
- unpack – Decompress/unzip the package downloaded.
The code in its entirety can be found here.
Demonstration
Scenario 1: Geckodriver is not found in system.





Scenario 2: Geckodriver.exe exists


Scenario 3: geckodriver.exe put to recycle bin
Anything in recycle bin if not empty or not securely deleted is not actually deleted, the file is still in the Windows.


Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.
best training institutions