Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set logging level for requests via new Server options #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions gocd/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,20 @@ class Server(object):
Example: http://go.example.com/
user (str): The username to login as
password (str): The password for this user
options (dict, optional): Some options, eg. set request debug level
"""
SESSION_COOKIE_NAME = 'JSESSIONID'

#: Sets the debug level for the urllib2 HTTP(s) handlers
request_debug_level = 0
DEFAULT_REQUEST_DEBUG_LEVEL = 0

_session_id = None
_authenticity_token = None

def __init__(self, host, user=None, password=None):
def __init__(self, host, user=None, password=None, options={}):
self.host = host
self.user = user
self.password = password
# Sets the debug level for the urllib2 HTTP(s) handlers
self.request_debug_level = options.get('request_debug_level', self.DEFAULT_REQUEST_DEBUG_LEVEL)

if self.user and self.password:
self._add_basic_auth()
Expand Down