Skip to content

lenileiro/politico-api

Repository files navigation

Badges

Build Status Coverage Status Codacy Badge

Politico API's

v1 endpoint

Project developer is to create a set of API endpoints defined in the API Endpoints Specification section and use data structures to store data in memory

Below are the Endpoints that have been created.

Party Endpoints

EndPoints Functionality HTTP Method
api/v1/parties Create party POST
api/v1/parties Fetch all parties GET
api/v1/parties/int:party_id Fetch single party GET
api/v1/parties/int:party_id Delete party DELETE
api/v1/parties/int:party_id/name Edit party PATCH

Office Endpoint

EndPoints Functionality HTTP Method
api/v1/offices Create office POST
api/v1/offices Fetch all offices GET
api/v1/offices/int:office_id Fetch single office GET

Heroku Link (version 1)

Navigate to this link to run the application on heroku

v2 endpoint

This project developer is to create a set of API endpoints defined in the API Endpoints Specification section and use database to persist data.

Below are the Endpoints that have been created.

Party (v2) Endpoints

EndPoints Functionality HTTP Method
api/v2/parties Create party POST
api/v2/parties Fetch all parties GET
api/v2/parties/int:party_id Fetch single party GET
api/v2/parties/int:party_id Delete party DELETE
api/v2/parties/int:party_id/name Edit party PATCH

Office (v2) Endpoint

Office

EndPoints Functionality HTTP Method
api/v2/office/int:office_id/register Register Citizen as a Candidate POST
api/v2/office/int:office_id/results Fetch result of specific office GET

Offices

EndPoints Functionality HTTP Method
api/v2/offices Create office POST
api/v2/offices Fetch all offices GET
api/v2/offices/int:office_id Fetch single office GET

Auth (v2) Endpoint

EndPoints Functionality HTTP Method
api/v2/auth/signup Create a user account POST
api/v2/auth/login Login a User POST
api/v2/auth/reset/ Password Reset POST

Root (v2) Endpoint

EndPoints Functionality HTTP Method
api/v2/votes/ Vote for a candidate POST
api/v2/petitions/ Create Petitions POST

Heroku Link (version 2)

Navigate to this link to run the application on heroku

Api Endpoint Documentation (version 2)

Link to documentation Page link

TOOLS USED IN THE CHALLENGE

  1. Server-Side Framework:Flask Python Framework
  2. Linting Library:Pylint, a Python Linting Library
  3. Style Guide:PEP8 Style Guide
  4. Testing Framework:PyTest, a Python Testing Framework
  5. Testing Endpoints: PostMan
  6. Testing Framework:Coverage, a Python Testing Framework

Setup and Installation

1 Clone repo from github

    ```bash
        git clone https://github.com/lenileiro/politico-api.git

        cd politico-api

        git checkout develop branch
    ```

2 Create a virtual environment

    ```bash
        virtualenv venv

    ```

3 Activate the virtual environment

    ```bash
        source venv/bin/activate

    ```

4 Install project dependencies

     ```bash
        pip install -r requirements.txt

    ```

Running Application

    ```bash
        source .env
        python run.py

    ```

Running Tests

    ```bash
        coverage run --source=app -m pytest && coverage report

    ```

author

Anthony Leiro

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published