@@ -18,30 +18,30 @@ class ResponseTemplate(object):
18
18
"""
19
19
20
20
def __init__ (self , response = "" ):
21
- descr = "Empty API response. Probably unreachable API end point"
22
21
#: Holds the response as plain text / string
23
- self .__raw = response
22
+ self ._raw = response
24
23
if (response is "" ) or (response is None ):
25
- self .__raw = "[RESPONSE]\r \n CODE=423\r \n DESCRIPTION=%s\r \n EOF\r \n " % (descr )
24
+ descr = "Empty API response. Probably unreachable API end point {CONNECTION_URL}"
25
+ self ._raw = "[RESPONSE]\r \n CODE=423\r \n DESCRIPTION=%s\r \n EOF\r \n " % (descr )
26
26
27
27
# try/except to support old versions of python (python2.5)
28
28
try :
29
- if isinstance (self .__raw , bytes ):
30
- self .__raw = self .__raw .decode ("utf-8" )
29
+ if isinstance (self ._raw , bytes ):
30
+ self ._raw = self ._raw .decode ("utf-8" )
31
31
except UnicodeError :
32
- self .__raw = self .__raw .decode ("latin1" )
32
+ self ._raw = self ._raw .decode ("latin1" )
33
33
except BaseException :
34
- self .__raw = self .__raw .decode ("utf-8" )
34
+ self ._raw = self ._raw .decode ("utf-8" )
35
35
36
36
if isinstance (response , dict ):
37
37
raise TypeError ('Type "dict" is not allowed for parameter "response". Use type "string" instead.' )
38
38
else :
39
39
#: Holds the response as hash
40
- self .__hash = RP .parse (self .__raw )
40
+ self .__hash = RP .parse (self ._raw )
41
41
42
42
if ('CODE' not in self .__hash ) or ('DESCRIPTION' not in self .__hash ):
43
- self .__raw = '[RESPONSE]\r \n CODE=423\r \n DESCRIPTION=Invalid API response. Contact Support\r \n EOF\r \n '
44
- self .__hash = RP .parse (self .__raw )
43
+ self ._raw = '[RESPONSE]\r \n CODE=423\r \n DESCRIPTION=Invalid API response. Contact Support\r \n EOF\r \n '
44
+ self .__hash = RP .parse (self ._raw )
45
45
46
46
def getCode (self ):
47
47
"""
@@ -59,7 +59,7 @@ def getPlain(self):
59
59
"""
60
60
Returns the plain API response
61
61
"""
62
- return self .__raw
62
+ return self ._raw
63
63
64
64
def getQueuetime (self ):
65
65
"""
0 commit comments