https://github.com/appatalks/fifo_api_gateway_server
FIFO API Gateway
https://github.com/appatalks/fifo_api_gateway_server
api-gateway api-throttling docker ghes github limiter openai rate-limiting server yahoo-finance
Last synced: 2 months ago
JSON representation
FIFO API Gateway
- Host: GitHub
- URL: https://github.com/appatalks/fifo_api_gateway_server
- Owner: appatalks
- License: gpl-3.0
- Created: 2024-07-02T01:04:28.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-21T00:33:50.000Z (almost 2 years ago)
- Last Synced: 2025-02-15T05:55:14.678Z (over 1 year ago)
- Topics: api-gateway, api-throttling, docker, ghes, github, limiter, openai, rate-limiting, server, yahoo-finance
- Language: Python
- Homepage:
- Size: 149 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## FIFO API Gateway Server
### Overview
A simple FIFO API Gateway for managing API calls, storing them in MySQL, and processing in order.
### Prerequisites
- ```Python 3.x```, ```Flask```, ```MySQL```, ```pip```
#### Instructions for Production Deployment found [Here](docker/README.md).
### Setup - Dev Environment / Small Deployment
1. Create a ```MySQL``` **User** and **Database** on ```MySQL 8``` or better.
```mysql
CREATE DATABASE IF NOT EXISTS api_gateway_fifo;
CREATE USER IF NOT EXISTS 'api_gateway'@'%' IDENTIFIED BY 'your_mysql_password';
GRANT ALL PRIVILEGES ON api_gateway_fifo.* TO 'api_gateway'@'%';
FLUSH PRIVILEGES;
```
2. Clone Repository:
```bash
git clone https://github.com/appatalks/fifo_api_gateway_server.git
cd api_fifo_limiter
```
3. Install Dependencies:
```bash
pip install flask mysql-connector-python
```
4. Initialize MySQL Database:
```bash
python fifo_init.py
```
### Usage
- Start Server
```bash
python api_fifo_server.py
```
- Direct API to Server Endpoint
```bash
curl -k -X POST https://127.0.0.1:5000/api/save -H "Content-Type: application/json" -d '{"data": "example data"}'
```
- Retrieve from MySQL and Delete Data;
```bash
curl -k -X GET https://127.0.0.1:5000/api/deliver
```
(Use ```valid certificates```, otherwise accept ```self-signed``` as valid with ```curl -k``` flag)
### See [API Endpoint Integration Examples](delivery/README.md)
----
## Highlights
### Task Queue Management
#### Background Processing
- **Use Case**: Applications that need to manage background tasks.
- **Benefit**: Ensures tasks are processed in the order they were received.
#### Job Scheduling
- **Use Case**: Managing job scheduling systems.
- **Benefit**: Ensures jobs are executed in a specific order.
- **Example**: Regularly process queued request in-line with endpoint ```ratelimit``` gates.
### Logging and Analytics
#### Event Logging
- **Use Case**: Serving as an event logging system.
- **Benefit**: Events are stored and processed in the order they occur.
#### Data Analytics
- **Use Case**: Data analytics pipelines.
- **Benefit**: Processes data in the sequence it was received to maintain temporal consistency.