Skip to main content

A configurable HTTP stub server for e-commerce API testing

Project description

๐Ÿš€ E-commerce API - Python Server

A configurable HTTP stub server for testing and development, built with Flask.


๐Ÿ“ Project Structure

๐Ÿ“ OJTpython/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ server.py              # Main Python server
โ”œโ”€โ”€ ๐Ÿ“„ data.py                # Product catalog (60+ products)
โ”œโ”€โ”€ ๐Ÿ“„ config.json            # API endpoints configuration
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt       # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore             # Git ignore rules
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ scripts/               # Utility scripts
โ”‚   โ”œโ”€โ”€ install.bat           # Setup script (Windows)
โ”‚   โ”œโ”€โ”€ run.bat               # Quick start script
โ”‚   โ””โ”€โ”€ test_api.py           # Automated testing
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ docs/                  # Documentation
โ”‚   โ”œโ”€โ”€ START_HERE.md         # ๐Ÿ‘ˆ Start here!
โ”‚   โ”œโ”€โ”€ README_PYTHON.md      # Complete guide
โ”‚   โ”œโ”€โ”€ QUICK_START_HINDI.md  # Hindi setup guide
โ”‚   โ”œโ”€โ”€ DEMO_CHECKLIST.md     # Demo preparation
โ”‚   โ”œโ”€โ”€ POSTMAN_TESTING_GUIDE.md
โ”‚   โ”œโ”€โ”€ NODEJS_VS_PYTHON.md
โ”‚   โ””โ”€โ”€ ... (other guides)
โ”‚
โ””โ”€โ”€ ๐Ÿ“ logs/                  # Server logs
    โ””โ”€โ”€ requests.log          # API request logs

โšก Quick Start

Option 1: Using Scripts (Windows)

# Install dependencies
scripts\install.bat

# Start server
scripts\run.bat

Option 2: Manual

# Install dependencies
pip install -r requirements.txt

# Start server
python server.py

Option 3: Test Everything

python scripts\test_api.py

๐ŸŒ Server Info

Port: 5600
URL: http://localhost:5600

Status Check:

curl http://localhost:5600

๐Ÿ“š Documentation


๐ŸŽฏ Features

โœ… Authentication - Token-based security
โœ… Dynamic Routing - Config-driven endpoints
โœ… Template Variables - {{timestamp}}, {{randomId}}, etc.
โœ… Request Logging - All API calls logged
โœ… 60+ Products - Complete e-commerce catalog
โœ… 15+ Endpoints - Full shopping flow


๐Ÿ”‘ API Endpoints

Authentication

  • POST /register - Create account
  • POST /login - User login

Products (Auth Required)

  • GET /categories - All categories
  • GET /categories/:id - Category details
  • GET /categories/:id/subcategories/:id - Products list
  • GET /categories/:id/subcategories/:id/products/:id - Product details

Shopping (Auth Required)

  • POST /cart/add - Add to cart
  • GET /cart - View cart
  • POST /order/place - Place order
  • GET /orders - Order history
  • GET /order/:id - Track order

๐Ÿงช Testing

Automated Testing

python scripts\test_api.py

Manual Testing (Postman)

See POSTMAN_TESTING_GUIDE.md


๐Ÿ“Š Tech Stack

  • Python 3.8+
  • Flask 3.0.0 - Web framework
  • Flask-CORS 4.0.0 - Cross-origin support
  • Watchdog 3.0.0 - File monitoring

๐ŸŽ“ For Students/Demo

This project is perfect for:

  • โœ… Academic presentations
  • โœ… API development learning
  • โœ… Backend testing
  • โœ… Postman demonstrations

Demo Time: 10-12 minutes
Difficulty: Beginner-friendly


๐Ÿ“ Logs

All API requests are logged to:

logs/requests.log

Each entry includes:

  • Timestamp
  • HTTP method
  • URL path
  • Status code
  • Response time

๐Ÿค Contributing

This is a learning project. Feel free to:

  • Add more endpoints
  • Enhance features
  • Improve documentation

๐Ÿ“„ License

MIT License - Free to use for learning and development


๐Ÿ†˜ Need Help?

  1. Check START_HERE.md
  2. Read QUICK_START_HINDI.md
  3. Review DEMO_CHECKLIST.md

Made with โค๏ธ for learning Python backend development

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

http_stub_server-1.0.0.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

http_stub_server-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file http_stub_server-1.0.0.tar.gz.

File metadata

  • Download URL: http_stub_server-1.0.0.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for http_stub_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b89cc3f0892e1c37e420ce0774571c87e560a02e8e9108830bd5f372221d98a4
MD5 f93f3177fbe50fe50fa9e32f7c986555
BLAKE2b-256 c7005f09d6e4d90f178fd3ddcfa5b2097789b238ad7d8c717986b2b260adeefb

See more details on using hashes here.

File details

Details for the file http_stub_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for http_stub_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ce09194f3583a8b98ba3d9645a194fc369076faf7c5cc06ef1b370b1a67ee3c
MD5 01c437d42a175b020b69713dc539ecaa
BLAKE2b-256 da3768aa2ca5f3752528c05ecf1d9cde0d378eccf3a494986f3ec018f3afd6be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page