Skip to content

Commit b0c22e6

Browse files
fix(htrace) remove warnings under -k / --insecure mode
* Insecure mode worked previously, but still inserted warnings into the output. With this commit, those warnings are now suppressed when `--insecure` in effect.
1 parent 129a1c7 commit b0c22e6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

htrace/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77
import time
88
import urllib.parse
9+
import urllib3
910

1011
W = '\033[0m' # white (normal)
1112
R = '\033[31m' # red
@@ -75,6 +76,9 @@ def cbLinkFollow(response, *args, **kwargs):
7576
@click.option("-R", "--link-rel", default='alternate', help="Follow link header with rel")
7677
@click.option("-P", "--link-profile", default=None, help="Follow link header with profile")
7778
def main(url, timeout, accept, json_report, insecure, body, link_type, link_rel, link_profile):
79+
if insecure:
80+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
81+
7882
logging.basicConfig(
7983
level=logging.INFO,
8084
format="%(asctime)s.%(msecs)03d:%(name)s %(message)s",

0 commit comments

Comments
 (0)