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

Method put

Algorithmia/datafile.py:122–135  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

120 return (response.status_code == 200, error)
121
122 def put(self, data):
123 # Post to data api
124
125 # First turn the data to bytes if we can
126 if isinstance(data, six.string_types) and not isinstance(data, six.binary_type):
127 data = bytes(data.encode())
128 if isinstance(data, six.binary_type):
129 result = self.client.putHelper(self.url, data)
130 if 'error' in result:
131 raise raiseDataApiError(result)
132 else:
133 return self
134 else:
135 raise TypeError("Must put strings or binary data. Use putJson instead")
136
137 def putJson(self, data):
138 # Post to data api

Callers 5

putHelperMethod · 0.45
list_files_smallMethod · 0.45
get_filesMethod · 0.45

Calls 2

raiseDataApiErrorFunction · 0.90
putHelperMethod · 0.80

Tested by 4

list_files_smallMethod · 0.36
get_filesMethod · 0.36