
This version uses dummy data instead of real APIs or web scraping, making it perfect for learning, testing, and understanding the data flow without external dependencies.
-
📦 Clean and modular Python structure
-
🌐 Simulated country and leader data
-
🧠 Wikipedia paragraph fetching (mocked)
-
⏱️ Artificial delay to mimic real API requests
-
🗂️ JSON export with readable formatting
-
🧪 Perfect for practicing:
- loops
- functions
- dictionaries
- file handling
- project structure
.
├── main.py
└── leaders_data.json # generated after running the script
- A list of countries is loaded from dummy data.
- Each country is processed one by one.
- Leaders of that country are retrieved.
- A simulated Wikipedia first paragraph is generated.
- All data is stored in a dictionary.
- The final result is exported as a JSON file.
git clone https://github.com/your-username/leaders-data-project.git
cd leaders-data-projectpython main.pyAfter running the script, a file named:
leaders_data.json
will be created.
Example output:
{
"us": [
{
"name": "George Washington",
"start_date": "1789",
"end_date": "1797",
"wikipedia_first_paragraph": "This is a simulated first paragraph for https://en.wikipedia.org/wiki/George_Washington"
}
]
}This project is ideal for practicing:
- Working with structured data
- Writing reusable functions
- Iterating through nested data
- Creating JSON files
- Building a real-world style data pipeline (without real APIs yet)
You can upgrade this project by:
- 🌐 Replacing dummy data with a real API
- 🕷️ Implementing real Wikipedia scraping (BeautifulSoup / requests)
- ⚡ Adding async requests for performance
- 🧩 Converting the script into a class-based architecture
- 🖥️ Creating a simple CLI interface
- 🐳 Dockerizing the project
- Python 3
- json
- time
(No external libraries required)
Fetching leaders for us...
Fetching info for George Washington...
Fetching info for Abraham Lincoln...
Fetching leaders for fr...
Fetching info for Napoleon Bonaparte...
Fetching leaders for be...
Fetching info for Leopold II of Belgium...
Done! 'leaders_data.json' has been created with dummy data.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is open-source and available under the MIT License.
Built as a learning project to practice Python data workflows and GitHub project structure.