1
0
mirror of https://github.com/httpie/cli.git synced 2024-11-24 08:22:22 +02:00

Refactored @mmb's fix to --verify; updated docs.

Closes #32.
This commit is contained in:
Jakub Roztocil 2012-04-11 12:44:02 +02:00
parent 71d21d1feb
commit c6c1489212
3 changed files with 16 additions and 14 deletions

View File

@ -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-

View File

@ -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),

View File

@ -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(