Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions shotgun_api3/shotgun.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -1255,8 +1255,10 @@ def _call_rpc(self, method, params, include_script_name=True, first=False):
try:
self._parse_http_status(http_status)
except ProtocolError, e:
if e.errcode == 503:
e.reason = "Shotgun is currently down for maintenance. Please try again later."
e.headers = resp_headers
# 403 is returned with custom error page when api access is blocked
if e.errcode == 403:
e.errmsg += ": %s" % body
raise

response = self._decode_response(resp_headers, body)
Expand DownExpand Up@@ -1385,16 +1387,16 @@ def _parse_http_status(self, status):
:param status: Tuple of (code, reason).
"""
error_code = status[0]
reason = status[1]
errmsg = status[1]

if status[0] >= 300:
msg = "HTTP error from server"
headers = "HTTP error from server"
if status[0] == 503:
reason = "Shotgun is currently down for maintenance. Please try again later."
errmsg = "Shotgun is currently down for maintenance. Please try again later."
raise ProtocolError(self.config.server,
error_code,
reason,
msg)
errmsg,
headers)

return

Expand Down