| 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 |