Minimize download logging
This commit is contained in:
parent
bf45cd5e13
commit
69d282fa01
1 changed files with 13 additions and 11 deletions
|
@ -188,7 +188,7 @@ class DownloadUtils():
|
||||||
|
|
||||||
def downloadUrl(self, url, postBody=None, type="GET", parameters=None, authenticate=True, headerOptions={}):
|
def downloadUrl(self, url, postBody=None, type="GET", parameters=None, authenticate=True, headerOptions={}):
|
||||||
|
|
||||||
self.logMsg("=== ENTER downloadUrl ===", 2)
|
# self.logMsg("=== ENTER downloadUrl ===", 2)
|
||||||
|
|
||||||
timeout = self.timeout
|
timeout = self.timeout
|
||||||
default_link = ""
|
default_link = ""
|
||||||
|
@ -302,18 +302,19 @@ class DownloadUtils():
|
||||||
verify=verifyssl)
|
verify=verifyssl)
|
||||||
|
|
||||||
##### THE RESPONSE #####
|
##### THE RESPONSE #####
|
||||||
self.logMsg(r.url, 2)
|
# self.logMsg(r.url, 2)
|
||||||
if r.status_code == 204:
|
if r.status_code == 204:
|
||||||
# No body in the response
|
# No body in the response
|
||||||
self.logMsg("====== 204 Success ======", 2)
|
# self.logMsg("====== 204 Success ======", 2)
|
||||||
|
pass
|
||||||
|
|
||||||
elif r.status_code == requests.codes.ok:
|
elif r.status_code == requests.codes.ok:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Allow for xml responses
|
# Allow for xml responses
|
||||||
r = etree.fromstring(r.content)
|
r = etree.fromstring(r.content)
|
||||||
self.logMsg("====== 200 Success ======", 2)
|
# self.logMsg("====== 200 Success ======", 2)
|
||||||
self.logMsg("Received an XML response for: %s" % url, 2)
|
# self.logMsg("Received an XML response for: %s" % url, 2)
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
@ -321,16 +322,17 @@ class DownloadUtils():
|
||||||
try:
|
try:
|
||||||
# UNICODE - JSON object
|
# UNICODE - JSON object
|
||||||
r = r.json()
|
r = r.json()
|
||||||
self.logMsg("====== 200 Success ======", 2)
|
# self.logMsg("====== 200 Success ======", 2)
|
||||||
self.logMsg("Response: %s" % r, 2)
|
# self.logMsg("Response: %s" % r, 2)
|
||||||
return r
|
return r
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
if r.text == '' and r.status_code == 200:
|
if r.text == '' and r.status_code == 200:
|
||||||
self.logMsg("====== 200 Success ======", 2)
|
# self.logMsg("====== 200 Success ======", 2)
|
||||||
self.logMsg("Answer from PMS does not contain a body", 2)
|
# self.logMsg("Answer from PMS does not contain a body", 2)
|
||||||
self.logMsg("Unable to convert the response for: %s" % url, 2)
|
pass
|
||||||
self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
# self.logMsg("Unable to convert the response for: %s" % url, 2)
|
||||||
|
# self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
||||||
except:
|
except:
|
||||||
self.logMsg("Unable to convert the response for: %s" % url, 2)
|
self.logMsg("Unable to convert the response for: %s" % url, 2)
|
||||||
self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
||||||
|
|
Loading…
Reference in a new issue