Skip to content
Open
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
18 changes: 16 additions & 2 deletions shotgun_api3/shotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -3976,8 +3976,15 @@ def _upload_data_to_storage(self, data, content_type, size, storage_url):
request.add_header("Content-Type", content_type)
request.add_header("Content-Length", size)
request.get_method = lambda: "PUT"
result = opener.open(request)
if self.config.timeout_secs is not None:
result = opener.open(request, timeout=self.config.timeout_secs)
else:
result = opener.open(request)
etag = result.info()["Etag"]

except ssl.SSLError, e:
raise ShotgunError("Unanticipated error occurred uploading to %s: %s" % (storage_url, e))

except urllib.error.HTTPError as e:
if e.code == 500:
raise ShotgunError("Server encountered an internal error.\n%s\n%s\n\n" % (storage_url, e))
Expand Down Expand Up @@ -4069,9 +4076,16 @@ def _send_form(self, url, params):

# Perform the request
try:
resp = opener.open(url, params)
if self.config.timeout_secs is not None:
resp = opener.open(url, params, timeout=self.config.timeout_secs)
else:
resp = opener.open(url, params)
result = resp.read()
# response headers are in str(resp.info()).splitlines()

except ssl.SSLError, e:
raise ShotgunError("Unanticipated error occurred %s" % (e))

except urllib.error.HTTPError as e:
if e.code == 500:
raise ShotgunError("Server encountered an internal error. "
Expand Down