calcurse-caldav: Show debug output before checking status

Make sure we print the headers and the body of a HTTP response in debug
mode, even if the HTTP status code indicates failure.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2016-01-24 13:44:27 +01:00
parent b9d80c3cf4
commit 7e7d21722a

View File

@ -102,11 +102,6 @@ def remote_query(cmd, path, additional_headers, body):
if not resp:
return (None, None)
if resp.status - (resp.status % 100) != 200:
die(("The server at %s replied with HTTP status code %d (%s) " +
"while trying to access %s.") %
(hostname, resp.status, resp.reason, path))
headers = resp.getheaders()
body = resp.read().decode('utf-8')
@ -116,6 +111,11 @@ def remote_query(cmd, path, additional_headers, body):
print("< " + line)
print()
if resp.status - (resp.status % 100) != 200:
die(("The server at %s replied with HTTP status code %d (%s) " +
"while trying to access %s.") %
(hostname, resp.status, resp.reason, path))
return (headers, body)
def get_hrefmap(conn, uid=None):