Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/achanandhi-m/flask-webapp
https://github.com/achanandhi-m/flask-webapp
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/achanandhi-m/flask-webapp
- Owner: Achanandhi-M
- Created: 2024-02-07T18:55:00.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-16T07:36:50.000Z (11 months ago)
- Last Synced: 2024-11-05T22:05:57.617Z (3 months ago)
- Language: Python
- Size: 96.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```markdown
# Flask Electricity Billing API## Introduction
This Flask application provides an API for electricity billing. Users can log in and calculate their electricity bills based on meter readings.## Installation
1. Install Flask and Flask-Session:
```bash
pip install Flask Flask-Session
```## Usage
1. Clone the repository.
2. Navigate to the project directory.### Running the Application
```bash
python app.py
```## API Endpoints
### 1. `/` (Login Endpoint)
- **Method:** POST
- **Input:**
- JSON:
```json
{
"name": {{user}}
"pass": {{pass}}
}
```
- **Output:**
- Success:
```json
{
"message": "Success",
"user": "John"
}
```
- Error:
```json
{
"message": "User Not Found :("
}
```### 2. `/bill` (Bill Endpoint)
- **Method:** POST
- **Input:**
- JSON:
```json
{
"Previous": 50,
"Present": 100
}
```
- **Output:**
- Success:
```json
{
"message": "Success",
"user": "John",
"total_units_consumed": 50,
"total_amount_rupees": 500
}
```
- Error:
```json
{
"message": "Error"
}
```## Testing with Postman
1. Open Postman.
2. Create a new request for each endpoint.
3. Set the request method to POST.
4. Enter the appropriate endpoint URL (e.g., `http://localhost:5000/`).
5. Add the required JSON parameters in the request body.
6. Click on the "Send" button to test the API