http code-解释http状态代码

httpcode的Python项目详细描述


 _   _ _____ _____ ____   ____ ___  ____  _____
| | | |_   _|_   _|  _ \ / ___/ _ \|  _ \| ____|
| |_| | | |   | | | |_) | |  | | | | | | |  _|
|  _  | | |   | | |  __/| |__| |_| | |_| | |___
|_| |_| |_|   |_| |_|    \____\___/|____/|_____|

httpcode是一个解释http含义的小实用程序 命令行上的状态代码。

http://httpcode.readthedocs.org

安装

$ [sudo] pip install httpcode

还有一个官方的deb套餐可以在 http://packages.debian.org/sid/httpcode

用法

解释405状态代码

$ hc 405
Status code 405
Message: Method Not Allowed
Code explanation: Specified method is invalid for this resource.

或418状态代码:)

$ hc 418
Status code 418
Message: I'm a teapot
Code explanation: The HTCPCP server is a teapot

列出所有代码

$ hc
Status code 100
Message: Continue
Code explanation: Request received, please continue

Status code 101
Message: Switching Protocols
Code explanation: Switching to new protocol; obey Upgrade header

Status code 200
Message: OK
Code explanation: Request fulfilled, document follows

...

按描述搜索代码(不区分大小写)

$ hc -s too
Status code 413
Message: Request Entity Too Large
Code explanation: Entity is too large.

Status code 414
Message: Request-URI Too Long
Code explanation: URI is too long.

使用正则表达式筛选代码

$ hc 30[12]
Status code 301
Message: Moved Permanently
Code explanation: Object moved permanently -- see URI list

Status code 302
Message: Found
Code explanation: Object moved temporarily -- see URI list

对任何数字使用“x”

$ hc 1xx
Status code 100
Message: Continue
Code explanation: Request received, please continue

Status code 101
Message: Switching Protocols
Code explanation: Switching to new protocol; obey Upgrade header

显示帮助

$ hc -h
Usage: hc [code] [options]

code may contain regular expression or use 'x' to denote any digit
code examples: 418, 30[12], 3.*, 1xx

Without parameters lists all available
HTTP status codes and their description


Options:
  -h, --help            show this help message and exit
  -s SEARCH, --search=SEARCH
                        Search for a code by name or description. Search text
                        may contain regular expressions.

路线图

添加更多代码

变更历史

0.6(2017-04-03)

  • 使用argparse而不是optparse
  • 声明为与Python2.7+和Python3兼容

0.5(2011-12-30)

  • 将http代码着色

0.4(2011-12-27)

0.3(2011-12-22)

0.2(2011-12-21)

0.1(2011-12-21)

  • 初始版本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java置换相关算法   在Java中读取/打开文本文件   java为什么这段代码不适用于CodeEval?   java如何将日历转换为JSON   从txt文件中读取字符串并将其存储到java中的字符数组中   字符编码Java ResourceBundles umlauts搞砸了   java为什么hashmap会根据总大小而不是填充的存储桶调整大小   java如何将Excel单元格中的数字字符串读取为字符串(而不是数字)?   java Guava的LocalCache无法使用,为什么?   java有没有办法强制JVM在单个处理器或内核上运行   java Eclipse不安装软件   将字节转换为java字符串(可能是汉字)   Java正则表达式:提取函数名   JavaTestNG:如何从多个类中指定测试方法顺序?