Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/paul-weqe/politico-api

POLITICO is a voting API based in Flask. It runs on the PostgreSQL database and CI/CD is performed through the Travis CI tool. Have fun with it :)
https://github.com/paul-weqe/politico-api

api flask jwt postgresql

Last synced: about 12 hours ago
JSON representation

POLITICO is a voting API based in Flask. It runs on the PostgreSQL database and CI/CD is performed through the Travis CI tool. Have fun with it :)

Awesome Lists containing this project

README

        

# POLITICO-API

## Progress
[![Coverage Status](https://coveralls.io/repos/github/Paul-weqe/POLITICO-API/badge.svg?branch=develop)](https://coveralls.io/github/Paul-weqe/POLITICO-API?branch=develop)

## API V2 DOCUMENTATION

## What is politico?

Politico is a government-like voting system. It allows for candidates to vie under political parties and allows for regular users to vote.

This API allows for exposure of the data held by POLITICO. This reference guide shows you how you can be able to access the data inside the POLITICO system online. Our frontend

## Setup guide
*NOTE* This setup guide assumes you have python and virtualenv installed in your system.

### creating the virtual environment
```
virtualenv venv
```

### activating the virtual environment

On linux
```
source venv/bin/activate
```

On Windows:
```
venv\Scripts\activate
```

### installing the requirements

All of the requirements will be installed through the requirements.txt file. Run the following command to install:

```
pip install -r requirements.txt
```

### running the application

To run the flask application, write the following command:

```
python run.py
```

### running tests on the application

The tests are contained in the *politico_api/tests/* folder. The tests can be run using the following command:

```
pytest politico/tests/
```

### getting coverage of the tests

To get the coverage of the tests, run:

```
pytest --cov=.
```

## where the API is hosted

**VERSION 1**
Hosting

| route | method | function | JSON fields |
| --- | --- | --- | --- |
| /api/v1/offices/ | POST | create a new office | "office_name": string, "office_type": string |
| /api/v1/offices/ | GET | get all offices | No json fields |
| /api/v1/offices/officeID | GET | gets a single office information | no json fields |
| /api/v1/parties/ | GET | gets all parties | no json field |
| /api/v1/parties/partyID/partyName | PATCH | edits a single party with ID partyID and sets its name to partyName | no json field |
| /parties/partyID | DELETE | deletes the party with ID partyID | no json field |
| /parties/partyID | GET | gets a single party with ID partyID | no json field |
| /parties/ | POST | creates a party | "party_name": string, "party_name": string, "party_hq_address": string, "party_logo_url": str, "party_motto": str, "party_members": int |

**VERSION 2**

Hosting

Documentation