Skip to content

Commit ae842bb

Browse files
authored
fix: add missing timeouts to server accessor (#58)
1 parent 47730e4 commit ae842bb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source/ftrack_api/accessor/server.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import hashlib
66
import base64
7-
import json
87

98
import requests
109

@@ -22,6 +21,7 @@ def __init__(self, resource_identifier, session, mode="rb"):
2221
self.mode = mode
2322
self.resource_identifier = resource_identifier
2423
self._session = session
24+
self._timeout = session.request_timeout
2525
self._has_read = False
2626

2727
super(ServerFile, self).__init__()
@@ -54,6 +54,7 @@ def _read(self):
5454
"apiKey": self._session.api_key,
5555
},
5656
stream=True,
57+
timeout=self._timeout,
5758
)
5859

5960
try:
@@ -105,7 +106,10 @@ def _write(self):
105106

106107
# Put the file based on the metadata.
107108
response = requests.put(
108-
metadata["url"], data=self.wrapped_file, headers=metadata["headers"]
109+
metadata["url"],
110+
data=self.wrapped_file,
111+
headers=metadata["headers"],
112+
timeout=self._timeout,
109113
)
110114

111115
try:
@@ -153,6 +157,7 @@ def __init__(self, session, **kw):
153157
super(_ServerAccessor, self).__init__(**kw)
154158

155159
self._session = session
160+
self._timeout = session.request_timeout
156161

157162
def open(self, resource_identifier, mode="rb"):
158163
"""Return :py:class:`~ftrack_api.Data` for *resource_identifier*."""
@@ -167,6 +172,7 @@ def remove(self, resourceIdentifier):
167172
"username": self._session.api_user,
168173
"apiKey": self._session.api_key,
169174
},
175+
timeout=self._timeout,
170176
)
171177
if response.status_code != 200:
172178
raise ftrack_api.exception.AccessorOperationFailedError(

0 commit comments

Comments
 (0)