Endangered Species Tracker is a Python tool that provides real-time information on endangered species around the world using the IUCN Red List API. It allows users to search for species and retrieve data on their conservation status, population trends, and habitat.
This project is part of Hacktoberfest 2024, encouraging contributors to enhance the platform and raise awareness about endangered species.
Install the required dependencies:
pip install requests python-decouple gradio
For testing, install pytest
:
pip install pytest
.env
file in the project root and add your API key:IUCN_API_KEY=your-api-key-here
git clone https://github.com/pycon-rwanda/Endangered-Species-Tracker
cd Endangered-Species-Tracker
python tracker.py
Search for a species:
Enter species name: Panthera leo
Example output:
Conservation Status: Vulnerable
Population Trend: Decreasing
Habitat: Savannas, grasslands, forests
Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines on how to get involved.
This project uses the IUCN Red List API. To retrieve species data, make a request as shown below:
import requests
from decouple import config
from dotenv import load_dotenv
load_dotenv()
API_KEY = config("IUCN_API_KEY")
species_name = 'Panthera leo'
url = f'https://apiv3.iucnredlist.org/api/v3/species/{species_name}?token={API_KEY}'
response = requests.get(url)
if response.status_code == 200:
data = response.json()
print(data)
else:
print("Error: Unable to fetch data.")
endangered-species-tracker/
│
├── tracker.py # Main script
├── README.md # Project documentation
├── CONTRIBUTING.md # Contribution guidelines
├── requirements.txt # Python dependencies
├── .env.example # API key placeholder
└── tests/ # Unit tests
This project is licensed under the MIT License. See the LICENSE file for details.