diff --git a/README.rst b/README.rst index 13ef9eef..9c2ae2c6 100644 --- a/README.rst +++ b/README.rst @@ -103,6 +103,13 @@ Flags ^^^^^ Most of the flags mirror the arguments understood by ``requests.request``. See ``http -h`` for more details:: + usage: http [-h] [--version] [--json | --form] [--traceback] + [--pretty | --ugly] + [--print OUTPUT_OPTIONS | --verbose | --headers | --body] + [--style STYLE] [--auth AUTH] [--verify VERIFY] + [--proxy PROXY] [--allow-redirects] [--timeout TIMEOUT] + METHOD URL [items [items ...]] + HTTPie - cURL for humans. positional arguments: @@ -147,10 +154,11 @@ Most of the flags mirror the arguments understood by ``requests.request``. See ` monokai, murphy, native, pastie, perldoc, solarized, tango, trac, vim, vs. Defaults to solarized. --auth AUTH, -a AUTH username:password - --verify VERIFY Set to "yes" to check the host's SSL certificate. You - can also pass the path to a CA_BUNDLE file for private - certs. You can also set the REQUESTS_CA_BUNDLE - environment variable. + --verify VERIFY Set to "no" to skip checking the host's SSL + certificate. You can also pass the path to a CA_BUNDLE + file for private certs. You can also set the + REQUESTS_CA_BUNDLE environment variable. Defaults to + "yes". --proxy PROXY String mapping protocol to the URL of the proxy (e.g. http:foo.bar:3128). --allow-redirects Set this flag if full redirects are allowed (e.g. re- diff --git a/httpie/__main__.py b/httpie/__main__.py index ec3c5cd0..1064f46a 100644 --- a/httpie/__main__.py +++ b/httpie/__main__.py @@ -131,13 +131,6 @@ def main(args=None, elif not files and 'Content-Type' not in headers: headers['Content-Type'] = TYPE_FORM - if args.verify == 'yes': - verify = True - elif args.verify == 'no': - verify = False - else: - verify = args.verify - # Fire the request. try: response = requests.request( @@ -145,7 +138,7 @@ def main(args=None, url=args.url if '://' in args.url else 'http://%s' % args.url, headers=headers, data=data, - verify=verify, + verify={'yes': True, 'no': False}.get(args.verify, args.verify), timeout=args.timeout, auth=(args.auth.key, args.auth.value) if args.auth else None, proxies=dict((p.key, p.value) for p in args.proxy), diff --git a/httpie/cli.py b/httpie/cli.py index 70830f89..e907b212 100644 --- a/httpie/cli.py +++ b/httpie/cli.py @@ -216,12 +216,13 @@ parser.add_argument( type=KeyValueType(SEP_COMMON) ) parser.add_argument( - '--verify', + '--verify', default='yes', help=_(''' - Set to "yes" to check the host\'s SSL certificate. + Set to "no" to skip checking the host\'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. + Defaults to "yes". ''') ) parser.add_argument(