Skip to content

Commit 5defba8

Browse files
authored
Merge pull request #62 from automata-tech/feature/timeouts
Make requests timeout match the API ones
2 parents e622663 + 4844530 commit 5defba8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

evasdk/eva_http_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# TODO add more granular logs using __logger
1010
# TODO lots of sleeps in control_* de to the robot state being updated slowly after starting an action, can this be improved?
11+
# TODO technically, the default request timeout of the API is 60s, should we update `request_timeout`?
1112

1213

1314
class EvaHTTPClient:
@@ -157,7 +158,7 @@ def users_get(self):
157158
def config_update(self, update):
158159
r = self.api_call_with_auth(
159160
'POST', 'config/update', update,
160-
headers={'Content-Type': 'application/x.automata-update'}, timeout=30
161+
headers={'Content-Type': 'application/x.automata-update'}, timeout=120
161162
)
162163
if r.status_code != 200:
163164
eva_error('config_update error', r)
@@ -232,13 +233,13 @@ def toolpaths_save(self, name, toolpathRepr):
232233

233234

234235
def toolpaths_use_saved(self, toolpathId):
235-
r = self.api_call_with_auth('POST', 'toolpaths/{}/use'.format(toolpathId))
236+
r = self.api_call_with_auth('POST', 'toolpaths/{}/use'.format(toolpathId), timeout=300)
236237
if r.status_code != 200:
237238
eva_error('toolpaths_use_saved error', r)
238239

239240

240241
def toolpaths_use(self, toolpathRepr):
241-
r = self.api_call_with_auth('POST', 'toolpath/use', json.dumps({'toolpath': toolpathRepr}))
242+
r = self.api_call_with_auth('POST', 'toolpath/use', json.dumps({'toolpath': toolpathRepr}), timeout=300)
242243
if r.status_code != 200:
243244
eva_error('toolpaths_use error', r)
244245

0 commit comments

Comments
 (0)