Skip to content

Instantly share code, notes, and snippets.

@lionelyoung
lionelyoung / http_server_auth.py
Last active September 4, 2022 15:07 — forked from mauler/http_server_auth.py
Python3 http.server supporting basic HTTP Auth (username/password)
# Extended python -m http.serve with --username and --password parameters for
# basic auth, based on https://gist.github.com/fxsjy/5465353
# Usage: python -m http_server_auth -u USERNAME -p PASSWORD -d .
from functools import partial
from http.server import SimpleHTTPRequestHandler, test
import base64
import os
class AuthHTTPRequestHandler(SimpleHTTPRequestHandler):