1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Added --auth-type and tests for basic/digest auth.

Closes #38.
This commit is contained in:
Jakub Roztocil
2012-04-11 13:47:47 +02:00
parent ee598d304d
commit 0c4c6c4753
3 changed files with 28 additions and 5 deletions

View File

@@ -134,10 +134,11 @@ 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)
if args.auth:
auth_type = (requests.auth.HTTPDigestAuth
if args.auth_type == 'digest'
else requests.auth.HTTPBasicAuth)
credentials = auth_type(args.auth.key, args.auth.value)
response = requests.request(
method=args.method.lower(),