def _fileUploadToCompute(self, endpoint): log.debug("Uploading image '{}' to compute".format(self._image.path)) parse_results = urllib.parse.urlparse(endpoint) network_manager = self._controller.getHttpClient().getNetworkManager() client = HTTPClient.fromUrl(endpoint, network_manager=network_manager) # We don't retry connection as in case of fail we try direct file upload client.setMaxRetryConnection(0) client.createHTTPQuery('POST', parse_results.path, self._checkIfSuccessfulCallback, body=pathlib.Path(self._image.path), context={"image_path": self._image.path}, progressText="Uploading {}".format(self._image.filename), timeout=None, prefix="")