diff options
| author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-08-08 11:39:45 +0200 |
|---|---|---|
| committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-08-08 11:39:45 +0200 |
| commit | c9915a4e43c4e7e0e086d815aec722a370e7e0b5 (patch) | |
| tree | 338965f1d4522bad8fb3d33dbbd45a4713b0b448 | |
| parent | e4624c9f17a8fbbe57da4316e6927f6d39bcc5a3 (diff) | |
| download | gitlab-c9915a4e43c4e7e0e086d815aec722a370e7e0b5.tar.gz | |
add a basic HTTP debug method
| -rw-r--r-- | gitlab/__init__.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py index fda3304..3979aa0 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -306,6 +306,20 @@ class Gitlab(object): self.email = email self.password = password + def enable_debug(self): + import logging + try: + from http.client import HTTPConnection + except ImportError: + from httplib import HTTPConnection + + HTTPConnection.debuglevel = 1 + logging.basicConfig() + logging.getLogger().setLevel(logging.DEBUG) + requests_log = logging.getLogger("requests.packages.urllib3") + requests_log.setLevel(logging.DEBUG) + requests_log.propagate = True + def _raw_get(self, path, content_type=None, streamed=False, **kwargs): url = '%s%s' % (self._url, path) headers = self._create_headers(content_type) |
