diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-24 13:44:27 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-24 13:44:27 +0100 |
commit | 7e7d21722adb1d456b269f387b909e86ff6828e2 (patch) | |
tree | ee929e258cef9a3ae8e74c7a45568f5ec19b6b79 | |
parent | b9d80c3cf4b3e7664c988b7d180dd074767f67d8 (diff) | |
download | calcurse-7e7d21722adb1d456b269f387b909e86ff6828e2.zip |
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>
-rwxr-xr-x | contrib/caldav/calcurse-caldav.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index 262f4ee..ff6bdc1 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -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): |