Allow multiple fields with the same name.

Applies to form data and URL params:

    http -f url a=1 a=2
    http url a==1 a==2
This commit is contained in:
Jakub Roztocil
2012-07-24 16:46:04 +02:00
parent 9944def703
commit 7af08b6faa
5 changed files with 68 additions and 20 deletions

View File

@ -37,10 +37,10 @@ def get_response(args):
try:
credentials = None
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)
credentials = {
'basic': requests.auth.HTTPBasicAuth,
'digest': requests.auth.HTTPDigestAuth,
}[args.auth_type](args.auth.key, args.auth.value)
return requests.request(
method=args.method.lower(),