Skip to content

Commit 8875a31

Browse files
author
Francisco Gray
committed
Making debug an optional attribute and changing existence test for it.
1 parent 62dfc2a commit 8875a31

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

netdot/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
__version__ = '0.01' ## Not always updated
3838

3939
class client(object):
40-
def __init__(self, username, password, server, debug):
40+
def __init__(self, username, password, server, debug = 0):
4141
"""__init__():
4242
Usage:
4343
uname = 'my_user'
@@ -107,7 +107,7 @@ def get(self, url):
107107
Result as a multi-level dictionary on sucess.
108108
"""
109109
response = requests.get(self.base_url + url, cookies=self.auth_cookies, headers=self.headers)
110-
if self.debug:
110+
if hasattr(client, 'debug'):
111111
return response.content
112112
if response.error:
113113
raise HTTPError
@@ -138,7 +138,7 @@ def post(self, url, data):
138138
Result as a multi-level dictionary on success
139139
"""
140140
response = requests.post(self.base_url + url, cookies=self.auth_cookies, data=data, headers=self.headers)
141-
if self.debug:
141+
if hasattr(client, 'debug'):
142142
return response.content
143143
if response.error:
144144
raise HTTPError
@@ -168,7 +168,7 @@ def delete(self, url):
168168
Result as a multi-level dictionary
169169
"""
170170
response = requests.delete(self.base_url + url, cookies=self.auth_cookies, headers=self.headers)
171-
if self.debug:
171+
if hasattr(client, 'debug'):
172172
return response.content
173173
if response.error:
174174
raise HTTPError

0 commit comments

Comments
 (0)