Skip to main content

Mini HTTP Server.

Project description

eatcook.

pip install eatcook

Eatcook is a simple socket HTTP server. With the ablity to run python files at interpret them as html. (Like CGI) The server also provides a extremely easy way to create sub pages. Using routebook.json to redirect users to them

routebook.json:

{
  "/", "index.html"  
}

OR

{
  "/", "index.py"
}

To get 404 page, place a file named 404.html in the folder in which you're running in.

Running at CLI

py -m eatcook --host 127.0.0.1 --port 8000 --folder (where http files are located)

Host & Port will run at 127.0.0.1:8000 by default if none are given.

Folder will also run in the directory of which you're working in if none are given: ./

Running in python

import eatcook

eatcook.run(host, port, folder) # Runs eatcook.
eatcook.add_route("/", "index.html") # Adds to script's route dict if no routebook.json is found. Though, it's much recommended to just use routebook.json

To run python scripts as html:

import random

generated = random.randint(1,100000)
print(f"<h1 align='center'>{generated}</h1>") # Sends a generated number to client's browser.

Information

Eatcook doesn't have the ablity to serve .css files. Though, I might muster up the courage to try 👀

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

eatcook-0.1.2.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

eatcook-0.1.2.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file eatcook-0.1.2.1.tar.gz.

File metadata

  • Download URL: eatcook-0.1.2.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.8.10 Linux/5.15.0-46-generic

File hashes

Hashes for eatcook-0.1.2.1.tar.gz
Algorithm Hash digest
SHA256 364b7be5f608a42b1dd09b5123dc25d840b7769704187b0154ea64aee35e06d7
MD5 b946f682450a891b26059e72680bbabd
BLAKE2b-256 7881ed646754341fc1c43b947361720405655f12779512b403cb65078d8668b0

See more details on using hashes here.

File details

Details for the file eatcook-0.1.2.1-py3-none-any.whl.

File metadata

  • Download URL: eatcook-0.1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.8.10 Linux/5.15.0-46-generic

File hashes

Hashes for eatcook-0.1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c63d5492f3dc887b16db0ed3e9bf035f0aa1275f4378ed85ae7f0c7351a1d5c
MD5 8ab0b5a5765763e9c6b9b2ddd0cf0bed
BLAKE2b-256 6196fd56aa328f453b9afa9ba06d3ba54f61b7c166084a74c3049fb57241f537

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