Skip to content

@dasickis /docopt_httpie
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Trying to implement HTTPie's CLI with docopt.
#!/usr/bin/env python
"""
usage: http [METHOD] <URL> [REQUEST ITEM [REQUEST ITEM ...]]
HTTPie - cURL for humans. <http://httpie.org>
Positional arguments:
These arguments come after any flags and in the order they are listed
here. Only URL is required.
METHOD The HTTP method to be used for the request (GET, POST,
PUT, DELETE, PATCH, ...). If this argument is omitted,
then HTTPie will guess the HTTP method. If there is
some data to be sent, then it will be POST, otherwise
GET.
URL The protocol defaults to http:// if the URL does not
include one.
REQUEST ITEM A key-value pair whose type is defined by the
separator used. It can be an HTTP header
(header:value), a data field to be used in the request
body (field_name=value), a raw JSON data field
(field_name:=value), a query parameter (name==value),
or a file field (field_name@/path/to/file). You can
use a backslash to escape a colliding separator in the
field name.
Suggestions and bug reports are greatly appreciated:
https://github.com/jkbr/httpie/issues
"""
from docopt import docopt
if __name__ == '__main__':
arguments = docopt(__doc__, version='0.3.1')
print(arguments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.