Skip to content

plaintextpackets/slowapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Slow API

Overview

This Flask app is a simple demonstration of a basic API that responds to requests with a delay. The app listens on the root route ('/') and introduces a delay of 5 seconds before responding with 'ok'. It can be configured to run over either HTTP or HTTPS.

Features

  • Simple API: A single route (/) that simulates a delayed response.
  • Configurable Protocol: Easily switch between HTTP and HTTPS.
  • Delay Response: Introduces a fixed delay of 5 seconds before responding to each request.

Requirements

  • Python 3
  • Flask
  • OpenSSL (for generating self-signed certificates, if using HTTPS)

Installation

  1. Clone the Repository:
git clone [your-repository-url]
cd [repository-name]
  1. Install Dependencies:
pip install flask
  1. Generate Self-Signed SSL Certificate for HTTPS:

Run this command to generate a self-signed SSL certificate and key:

openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365

Note: For production, use a certificate from a trusted certificate authority.

Configuration

HTTP/HTTPS Toggle: Set the USE_HTTPS variable in app.py to True to use HTTPS or False to use HTTP.

About

A simple Python-based API to demonstrate slow response times

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages