This project downloads the NGCDF (National Government Constituencies Development Fund) audit reports for the year 2021-2022 from the OAG Kenya website and saves them locally.
- Python 3.12.1
requests
librarybeautifulsoup4
library
-
Clone the repository or download the script file.
-
Install the required libraries using
pip
:pip install -r requirements.txt
-
Run the script to download the reports:
app.py
-
The reports will be saved in the
NGCDF 2021-2022
directory.
The script performs the following steps:
-
Sends a GET request to the OAG Kenya website to retrieve the HTML content.
-
Parses the HTML content using BeautifulSoup.
-
Extracts all
<a>
tags that contain the word "NGCDF". -
Extracts the download links for the reports from
<a>
tags with the classdlp-download-link dlp-download-button document-library-pro-button button btn
. -
Downloads the reports and saves them in the
NGCDF 2021-2022
directory with appropriate constituency names.