pycon-rwanda / Endangered-Species-Tracker

The "Endangered Species Tracker" is a Python project aimed at raising awareness and providing information about endangered species around the world.
MIT License
4 stars 9 forks source link
hacktoberfest hacktoberfest-accepted hacktoberfest2024 hacktoberfest2024-approved open-source python

Endangered Species Tracker

Table of Contents

Overview

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.

Objectives

Target Audience:

Features

Getting Started

Prerequisites

Installation

Install the required dependencies:

pip install requests python-decouple gradio

For testing, install pytest:

pip install pytest

API Key Setup

  1. Get a free API key from the IUCN Red List website.
  2. Create a .env file in the project root and add your API key:
IUCN_API_KEY=your-api-key-here

Running the Project

  1. Clone the repository:
git clone https://github.com/pycon-rwanda/Endangered-Species-Tracker
cd Endangered-Species-Tracker
  1. Run the tracker:
python tracker.py

Example Usage

Search for a species:

Enter species name: Panthera leo

Example output:

Conservation Status: Vulnerable
Population Trend: Decreasing
Habitat: Savannas, grasslands, forests

Contributing

Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines on how to get involved.

API Reference

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.")

Project Structure

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

License

This project is licensed under the MIT License. See the LICENSE file for details.