Skip to content

Commit

Permalink
Merge branch 'digest-auth' of https://github.com/dshafik/httpie into …
Browse files Browse the repository at this point in the history
…dshafik-digest-auth
  • Loading branch information
jkbrzt committed Apr 11, 2012
2 parents c6c1489 + 153663c commit ee598d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion httpie/__main__.py
Expand Up @@ -133,14 +133,20 @@ def main(args=None,

# Fire the request.
try:
credentials = None
if args.auth and args.digest:
credentials = requests.auth.HTTPDigestAuth(args.auth.key, args.auth.value)
elif args.auth:
credentials = requests.auth.HTTPBasicAuth(args.auth.key, args.auth.value)

response = requests.request(
method=args.method.lower(),
url=args.url if '://' in args.url else 'http://%s' % args.url,
headers=headers,
data=data,
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,
auth=credentials,
proxies=dict((p.key, p.value) for p in args.proxy),
files=files,
allow_redirects=args.allow_redirects,
Expand Down
5 changes: 5 additions & 0 deletions httpie/cli.py
Expand Up @@ -215,6 +215,11 @@ def _validate_output_options(self, args):
'--auth', '-a', help='username:password',
type=KeyValueType(SEP_COMMON)
)

parser.add_argument(
'--digest', '-d', action='store_true', help=_('Use Digest authentication')
)

parser.add_argument(
'--verify', default='yes',
help=_('''
Expand Down

0 comments on commit ee598d3

Please sign in to comment.