mirror of
https://github.com/httpie/cli.git
synced 2025-02-16 09:39:28 +01:00
Merge pull request #2 from flashingpumpkin/master
Added Python 2.6 compatibility.
This commit is contained in:
commit
f90ae113e4
@ -27,10 +27,11 @@ class KeyValueType(object):
|
|||||||
self.separators = separators
|
self.separators = separators
|
||||||
|
|
||||||
def __call__(self, string):
|
def __call__(self, string):
|
||||||
|
found = dict(
|
||||||
|
(string.find(sep), sep) for sep in self.separators
|
||||||
|
if string.find(sep) != -1
|
||||||
|
)
|
||||||
|
|
||||||
found = {string.find(sep): sep
|
|
||||||
for sep in self.separators
|
|
||||||
if string.find(sep) != -1}
|
|
||||||
if not found:
|
if not found:
|
||||||
raise argparse.ArgumentTypeError(
|
raise argparse.ArgumentTypeError(
|
||||||
'"%s" is not a valid value' % string)
|
'"%s" is not a valid value' % string)
|
||||||
@ -141,8 +142,8 @@ def main():
|
|||||||
verify=True if args.verify == 'yes' else args.verify,
|
verify=True if args.verify == 'yes' else args.verify,
|
||||||
timeout=args.timeout,
|
timeout=args.timeout,
|
||||||
auth=(args.auth.key, args.auth.value) if args.auth else None,
|
auth=(args.auth.key, args.auth.value) if args.auth else None,
|
||||||
proxies={proxy.key: proxy.value for proxy in args.proxy},
|
proxies=dict((p.key, p.value) for p in args.proxy),
|
||||||
files={os.path.basename(f.name): f for f in args.file}
|
files=dict((os.path.basename(f.name), f) for f in args.file),
|
||||||
)
|
)
|
||||||
except (KeyboardInterrupt, SystemExit) as e:
|
except (KeyboardInterrupt, SystemExit) as e:
|
||||||
sys.stderr.write('\n')
|
sys.stderr.write('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user