# quickhttp
[![Docs Status](https://img.shields.io/badge/docs-stable-informational)](https://jayqi.github.io/quickhttp/)
[![PyPI](https://img.shields.io/pypi/v/quickhttp.svg)](https://pypi.org/project/quickhttp/)
[![tests](https://github.com/jayqi/quickhttp/workflows/tests/badge.svg?branch=main)](https://github.com/jayqi/quickhttp/actions?query=workflow%3Atests+branch%3Amain)
[![codecov](https://codecov.io/gh/jayqi/quickhttp/branch/main/graph/badge.svg)](https://codecov.io/gh/jayqi/quickhttp)
`quickhttp` is a lightweight CLI that wraps Python's `http.server` with automatic port-finding and automatic shutdown after a configurable idle duration.
## Features
- Automatically finds and uses an available port.
- Has a keep-alive time after which it will shut down automatically if no requests are received, in case you forget about it.
- More secure default of `127.0.0.1` (`localhost`) instead of `0.0.0.0`.
- Easier to type and autocomplete than `python -m http.server`.
## Installation
You can get `quickhttp` from [PyPI](https://pypi.org/project/quickhttp/). I recommend using [`pipx`](https://pipxproject.github.io/pipx/) to manage Python command-line programs:
```bash
pipx install quickhttp
```
You can also install normally using regular `pip`:
```bash
pip install quickhttp
```
Requires Python 3.7 or higher. For Python 3.6, install [v1.0.0](https://pypi.org/project/quickhttp/1.0.0/).
### Development Version
To install the development version of this program, get it directly from GitHub.
```bash
pipx install git+https://github.com/jayqi/quickhttp.git
```
## Documentation
```bash
quickhttp --help
```
```text
Usage: quickhttp [OPTIONS] [DIRECTORY]
Lightweight CLI that wraps Python's `http.server` with automatic port-
finding and shutdown.
Arguments:
[DIRECTORY] Directory to serve. [default: .]
Options:
-t, --timeout TEXT Time to keep server alive for after most
recent request. Accepts time expressions
parsable by pytimeparse, such as '10m' or
'10:00'. [default: 10m]
-b, --bind TEXT Address to bind server to. '127.0.0.1' (or
'localhost') will only be accessible from
this computer. '0.0.0.0' is all interfaces
(IP addresses) on this computer, meaning
that it can be accessible by other computers
at your IP address. [default: 127.0.0.1]
-p, --port INTEGER Port to use. If None (default), will
automatically search for an open port using
the other port-related options. If
specified, ignores other port-related
options.
--port-range-min INTEGER Minimum of range to search for an open port.
[default: 8000]
--port-range-max INTEGER Maximum of range to search for an open port.
[default: 8999]
--port-max-tries INTEGER Maximum number of ports to check. [default:
50]
--port-search-type [sequential|random]
Type of search to use. [default:
sequential]
--version Show version and exit.
--install-completion [bash|zsh|fish|powershell|pwsh]
Install completion for the specified shell.
--show-completion [bash|zsh|fish|powershell|pwsh]
Show completion for the specified shell, to
copy it or customize the installation.
--help Show this message and exit.
```
## Why use `quickhttp`?
- `python -m http.server` is a pain to type. `quickhttp` is shorter and can autocomplete. (But you can still do `python -m quickhttp` too if you really want to.)
- If you try starting `python -m http.server` and port 8000 is unavailable, you get `OSError: [Errno 48] Address already in use`. Then you have to choose another port and try again. `quickhttp` deals with ports automatically for you.
- `quickhttp` will automatically shutdown after the keep-alive time expires. This defaults to 10 minutes. I often start up an HTTP server to look at something, then open a new tab to continue doing things, and then I forget about the server.
- `python -m http.server` defaults to 0.0.0.0, which may make your server accessible to other people at your computer's IP address. This is a security vulnerability, but isn't necessarily obvious to people who just want to quickly serve some static files.
Raw data
{
"_id": null,
"home_page": "https://github.com/jayqi/quickhttp",
"name": "quickhttp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "http server,dev server",
"author": "Jay Qi",
"author_email": "jayqi.opensource@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ef/02/b550ab067992c4fbfbc3e12ff612d9461aa10d116824246d8b7736a51a79/quickhttp-2.0.0.tar.gz",
"platform": null,
"description": "# quickhttp\n\n[![Docs Status](https://img.shields.io/badge/docs-stable-informational)](https://jayqi.github.io/quickhttp/)\n[![PyPI](https://img.shields.io/pypi/v/quickhttp.svg)](https://pypi.org/project/quickhttp/)\n[![tests](https://github.com/jayqi/quickhttp/workflows/tests/badge.svg?branch=main)](https://github.com/jayqi/quickhttp/actions?query=workflow%3Atests+branch%3Amain)\n[![codecov](https://codecov.io/gh/jayqi/quickhttp/branch/main/graph/badge.svg)](https://codecov.io/gh/jayqi/quickhttp)\n\n`quickhttp` is a lightweight CLI that wraps Python's `http.server` with automatic port-finding and automatic shutdown after a configurable idle duration.\n\n## Features\n\n- Automatically finds and uses an available port.\n- Has a keep-alive time after which it will shut down automatically if no requests are received, in case you forget about it.\n- More secure default of `127.0.0.1` (`localhost`) instead of `0.0.0.0`.\n- Easier to type and autocomplete than `python -m http.server`.\n\n## Installation\n\nYou can get `quickhttp` from [PyPI](https://pypi.org/project/quickhttp/). I recommend using [`pipx`](https://pipxproject.github.io/pipx/) to manage Python command-line programs:\n\n```bash\npipx install quickhttp\n```\n\nYou can also install normally using regular `pip`:\n\n```bash\npip install quickhttp\n```\n\nRequires Python 3.7 or higher. For Python 3.6, install [v1.0.0](https://pypi.org/project/quickhttp/1.0.0/).\n\n### Development Version\n\nTo install the development version of this program, get it directly from GitHub.\n\n```bash\npipx install git+https://github.com/jayqi/quickhttp.git\n```\n\n## Documentation\n\n```bash\nquickhttp --help\n```\n\n```text\nUsage: quickhttp [OPTIONS] [DIRECTORY]\n\n Lightweight CLI that wraps Python's `http.server` with automatic port-\n finding and shutdown.\n\nArguments:\n [DIRECTORY] Directory to serve. [default: .]\n\nOptions:\n -t, --timeout TEXT Time to keep server alive for after most\n recent request. Accepts time expressions\n parsable by pytimeparse, such as '10m' or\n '10:00'. [default: 10m]\n\n -b, --bind TEXT Address to bind server to. '127.0.0.1' (or\n 'localhost') will only be accessible from\n this computer. '0.0.0.0' is all interfaces\n (IP addresses) on this computer, meaning\n that it can be accessible by other computers\n at your IP address. [default: 127.0.0.1]\n\n -p, --port INTEGER Port to use. If None (default), will\n automatically search for an open port using\n the other port-related options. If\n specified, ignores other port-related\n options.\n\n --port-range-min INTEGER Minimum of range to search for an open port.\n [default: 8000]\n\n --port-range-max INTEGER Maximum of range to search for an open port.\n [default: 8999]\n\n --port-max-tries INTEGER Maximum number of ports to check. [default:\n 50]\n\n --port-search-type [sequential|random]\n Type of search to use. [default:\n sequential]\n\n --version Show version and exit.\n --install-completion [bash|zsh|fish|powershell|pwsh]\n Install completion for the specified shell.\n --show-completion [bash|zsh|fish|powershell|pwsh]\n Show completion for the specified shell, to\n copy it or customize the installation.\n\n --help Show this message and exit.\n```\n\n## Why use `quickhttp`?\n\n- `python -m http.server` is a pain to type. `quickhttp` is shorter and can autocomplete. (But you can still do `python -m quickhttp` too if you really want to.)\n- If you try starting `python -m http.server` and port 8000 is unavailable, you get `OSError: [Errno 48] Address already in use`. Then you have to choose another port and try again. `quickhttp` deals with ports automatically for you.\n- `quickhttp` will automatically shutdown after the keep-alive time expires. This defaults to 10 minutes. I often start up an HTTP server to look at something, then open a new tab to continue doing things, and then I forget about the server.\n- `python -m http.server` defaults to 0.0.0.0, which may make your server accessible to other people at your computer's IP address. This is a security vulnerability, but isn't necessarily obvious to people who just want to quickly serve some static files.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Lightweight CLI that wraps Python's http.server with automatic port-finding and shutdown.",
"version": "2.0.0",
"split_keywords": [
"http server",
"dev server"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5cc5a543b2ad0b2a5e95f7825422e0265b17cd222382984e7d0d1ac9885a106d",
"md5": "9882a6bbb7fd75c364e4b12911c29015",
"sha256": "8be64ff868e11af589ee9cff8c901723ec9dd607bc522eb45cddb48dac0f79b4"
},
"downloads": -1,
"filename": "quickhttp-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9882a6bbb7fd75c364e4b12911c29015",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 8286,
"upload_time": "2023-02-11T23:10:53",
"upload_time_iso_8601": "2023-02-11T23:10:53.091844Z",
"url": "https://files.pythonhosted.org/packages/5c/c5/a543b2ad0b2a5e95f7825422e0265b17cd222382984e7d0d1ac9885a106d/quickhttp-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ef02b550ab067992c4fbfbc3e12ff612d9461aa10d116824246d8b7736a51a79",
"md5": "9f75fe02d9721aa70c820f9936ad3b83",
"sha256": "4739e92a693772cd3bffa7afd4fdb4d5267a0894058d2e10bbd8189555790c5c"
},
"downloads": -1,
"filename": "quickhttp-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "9f75fe02d9721aa70c820f9936ad3b83",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 7548,
"upload_time": "2023-02-11T23:10:54",
"upload_time_iso_8601": "2023-02-11T23:10:54.620821Z",
"url": "https://files.pythonhosted.org/packages/ef/02/b550ab067992c4fbfbc3e12ff612d9461aa10d116824246d8b7736a51a79/quickhttp-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 23:10:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jayqi",
"github_project": "quickhttp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "quickhttp"
}