Skip to content

erdurano/fueler_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fueler API

Overview

Fueler API is a RESTful API designed to give optimal fuel stops for a route with given start and endpoints. It also calculates the total fuel spent.

Features

  • Getting route path points
  • Total fuel cost calculation
  • Generating map of the route and stops

Libraries

  • Django
  • Django Ninja for API routing and schema validation
  • folium for rendering HTML maps
  • geopy distance calculation functions
  • openrouteservice accessing OpenRouteServiceAPI
  • polyline decoding polyline number to extract route points
  • python-dotenv for loading environment variables where necessary

Installation

To install and run the Fueler API locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/erdurano/fueler_API.git
    cd fueler_API
  2. (If not used) Install uv Please refer to https://github.com/astral-sh/uv

  3. Install dependencies:

    uv sync
  4. Set up environment variables: Create a .env file in the root directory and add the following variables:

    MAPQUEST_KEY=your mapquest key
    OPENROUTE_KEY=your openrouteservice key
    

    [!IMPORTANT] MAPQUEST API is used for a migration that automatically populating database with longitude and latitude values of fuel stations. If not applied migration fails.

  5. Activate environment:

    source .venv/bin/activate
  6. Migrate the database:

    python manage.py migrate
  7. Run server:

    python manage.py runserver 

Usage

Once the server is running, you can access the API at http://localhost:8000. Use tools like Postman or cURL to interact with the endpoints.

API Endpoints

  • GET /api/docs/ For inspecting documentation. Documentation auto generated by django-ninja
  • POST /api/route/ - Get route and fuel stop info with providing start and end points through json
  • GET /api/route/ - Get route and fuel stop info with providing start and end points through query parameters.

Contact

For any questions or inquiries, please contact [email protected].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages