{ "info": { "author": "AndrewBC", "author_email": "andrew.b.coleman@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: HTTP Servers" ], "description": "simplehttpd\n============\n\nAn extendable replacement for http.server and its SimpleHTTPRequestHandler\n\nsimplehttpd was written as a quick hack to extend SimpleHTTPRequestHandler in http.server to be more, well, extendable.\nMy specific need was to be able to quickly run an http server from the command line that also sent a custom header to the client\nthat forbade caching of the content served, in order to quickly iterate in my web development project, being sure that the content\ntruly was the latest content. The opportunity arose to make it more generally extendable, as you'll see from usage below.\n\nUsage\n===== \nOnce you install with\n\tpython setup.py install\nor put simplehttpd wherever you need it, it mirrors the usage of http.server almost exactly.\n\nThe default port is 8000, but you can also set your own port.\n\tpython -m simplehttpd 8080\nAn alternative that allows more customization is:\n\tpython -c \"import simplehttpd; simplehttpd.run(port=8080)\"\n\nBut what if you want to send a custom header, like 'Cache-Control: no-cache' with every page load?\nWell, simplehttpd.handler has an object called custom_headers which (by default) is an OrderedDict. So let's do this:\n\tpython -c \"import simplehttpd; simplehttpd.handler.custom_headers['Cache-Control'] = 'no-cache'; simplehttpd.run()\"\n\nAnd for the really deep extending, you have even more options.\nThe custom header could be a callable that disallows caching files, but allows caching of directory lists.\n\tdef no_file_caching(response, file=None):\n\t\tif file is not None:\n\t\t\tself.send_header(\"Cache-Control\", 'no-cache')\nWhich will be called at send time.\n\nIf you're really crazy, you could even replace methods on the handler class like send_custom_headers, which dispatches each custom header\nOr replace the custom_headers OrderedDict on the handler class with your own kind of dict. It's just python, so let's hack!", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/AndrewBC/simplehttpd/downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AndrewBC/simplehttpd", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "simplehttpd", "package_url": "https://pypi.org/project/simplehttpd/", "platform": "Python", "project_url": "https://pypi.org/project/simplehttpd/", "project_urls": { "Download": "https://github.com/AndrewBC/simplehttpd/downloads", "Homepage": "https://github.com/AndrewBC/simplehttpd" }, "release_url": "https://pypi.org/project/simplehttpd/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "An extendable replacement for http.server and its SimpleHTTPRequestHandler", "version": "0.1.0" }, "last_serial": 502040, "releases": { "0.1.0": [] }, "urls": [] }