summaryrefslogtreecommitdiff
path: root/swiftclient
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2016-06-01 16:45:54 -0700
committerTim Burke <tim.burke@gmail.com>2016-06-01 18:57:38 -0700
commitff505d72cdec8adfee45852d564985798a563d21 (patch)
treed255acd5146ad8dc4095d237ed56f8fd480711d9 /swiftclient
parentf9d0657e70e9511a2d7b4c63bbf06b138dd0be5e (diff)
downloadpython-swiftclient-ff505d72cdec8adfee45852d564985798a563d21.tar.gz
Suppress InsecureRequestWarning when using --insecure
The user already knows this is insecure, there's no point in bringing it up again and again. See also: https://github.com/kennethreitz/requests/issues/2214 Change-Id: I7991b2e568407269f84138bc03711147ed080c9c
Diffstat (limited to 'swiftclient')
-rwxr-xr-xswiftclient/shell.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index 5eafe0b..486dc48 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -1524,6 +1524,11 @@ Examples:
with OutputManager() as output:
parser.usage = globals()['st_%s_help' % args[0]]
+ if options['insecure']:
+ import requests
+ from requests.packages.urllib3.exceptions import \
+ InsecureRequestWarning
+ requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
try:
globals()['st_%s' % args[0]](parser, argv[1:], output)
except ClientException as err: