Skip to content

Commit

Permalink
add a basic HTTP debug method
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Aug 8, 2016
1 parent e4624c9 commit c9915a4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gitlab/__init__.py
Expand Up @@ -306,6 +306,20 @@ def set_credentials(self, email, password):
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)
Expand Down

0 comments on commit c9915a4

Please sign in to comment.