MCPcopy Index your code
hub / github.com/algorithmiaio/algorithmia-python / putHelper

Method putHelper

Algorithmia/client.py:323–341  ·  view source on GitHub ↗
(self, url, data)

Source from the content-addressed store, hash-verified

321
322 # Used internally to http put a file
323 def putHelper(self, url, data):
324 headers = {}
325 if self.apiKey is not None:
326 headers['Authorization'] = self.apiKey
327 elif self.bearerToken is not None:
328 headers['Authorization'] = 'Bearer ' + self.bearerToken
329 if isJson(data):
330 headers['Content-Type'] = 'application/json'
331 response = self.requestSession.put(self.apiAddress + url, data=data, headers=headers)
332 if response._content == b'':
333 return response
334 if 200 <= response.status_code <= 299:
335 response = response.json()
336 if 'error' in response:
337 raise raiseAlgoApiError(response)
338 else:
339 return response
340 else:
341 raise raiseAlgoApiError(response)
342
343 # Used internally to http delete a file
344 def deleteHelper(self, url):

Callers 6

edit_orgMethod · 0.95
invite_to_orgMethod · 0.95
putMethod · 0.80
putJsonMethod · 0.80
putFileMethod · 0.80
updateMethod · 0.80

Calls 3

raiseAlgoApiErrorFunction · 0.90
isJsonFunction · 0.85
putMethod · 0.45

Tested by

no test coverage detected