Skip to content

Commit ffc3db1

Browse files
authored
Merge pull request #218 from hpe-container-platform-community/requests_debug_logging
add requests logging
2 parents 21cd265 + fdfe47a commit ffc3db1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
[![Good first issues open](https://img.shields.io/github/issues/hpe-container-platform-community/hpecp-python-library/good%20first%20issue.svg?label=good%20first%20issue)](https://github.com/hpe-container-platform-community/hpecp-python-library/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
1212

1313

14-
1514
----
1615

1716
## Documentation

hpecp/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
import os
2727
from configparser import SafeConfigParser
2828

29+
import logging
2930
import requests
31+
import six
3032
from six import raise_from
3133

3234
from .catalog import CatalogController
@@ -474,6 +476,16 @@ def create_session(self):
474476

475477
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
476478

479+
if self.log.level == 10: # "DEBUG"
480+
if six.PY3:
481+
import http.client
482+
483+
http.client.HTTPConnection.debuglevel = 1
484+
485+
requests_log = logging.getLogger("requests.packages.urllib3")
486+
requests_log.setLevel(logging.DEBUG)
487+
requests_log.propagate = True
488+
477489
response = None
478490
try:
479491
self.log.debug("REQ: {} : {} {}".format("Login", "post", url))

0 commit comments

Comments
 (0)