Skip to content

Commit c9915a4

Browse files
author
Gauvain Pocentek
committed
add a basic HTTP debug method
1 parent e4624c9 commit c9915a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

gitlab/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,20 @@ def set_credentials(self, email, password):
306306
self.email = email
307307
self.password = password
308308

309+
def enable_debug(self):
310+
import logging
311+
try:
312+
from http.client import HTTPConnection
313+
except ImportError:
314+
from httplib import HTTPConnection
315+
316+
HTTPConnection.debuglevel = 1
317+
logging.basicConfig()
318+
logging.getLogger().setLevel(logging.DEBUG)
319+
requests_log = logging.getLogger("requests.packages.urllib3")
320+
requests_log.setLevel(logging.DEBUG)
321+
requests_log.propagate = True
322+
309323
def _raw_get(self, path, content_type=None, streamed=False, **kwargs):
310324
url = '%s%s' % (self._url, path)
311325
headers = self._create_headers(content_type)

0 commit comments

Comments
 (0)