Skip to content

Commit

Permalink
Add debug log for issue #172
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Feb 12, 2018
1 parent 659202e commit 112a53b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions salesforce/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def soap_login(settings, session_id_expired=False, timeout=10):

result = {}
if response.status_code != 200:
# Log the error message
if settings["debug_mode"]:
print (response.content)

except_msg = util.getUniqueElementValueFromXmlString(response.content, 'sf:exceptionMessage')
result["Error Message"] = except_msg
result["success"] = False
Expand Down
2 changes: 2 additions & 0 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2902,6 +2902,8 @@ def getUniqueElementValueFromXmlString(xmlString, elementName):
if len(elementsByName) > 0:
elementValue = elementsByName[0].toxml().replace('<' +\
elementName + '>','').replace('</' + elementName + '>','')
else:
elementValue = xmlString.decode("utf-8")
return unescape(elementValue, {"&apos;": "'", "&quot;": '"'})

def get_response_error(response):
Expand Down

0 comments on commit 112a53b

Please sign in to comment.