Send data to a remote server, either with a POST or a PUT request.

        Args:
            `method`: The method (POST or PUT) to use.
            `path`: The path to the resource.
            `data`: The data to send.
            `filename`: The filename of the file to send (if any).
        Returns:
            The content of the response.
        Raises:
            An exception depending on the HTTP status code of the response.

def _send(self, method, path, data, filename):
        """Send data to a remote server, either with a POST or a PUT request.

        Args:
            `method`: The method (POST or PUT) to use.
            `path`: The path to the resource.
            `data`: The data to send.
            `filename`: The filename of the file to send (if any).
        Returns:
            The content of the response.
        Raises:
            An exception depending on the HTTP status code of the response.
        """
        if filename is None:
            return self._send_json(method, path, data)
        else:
            return self._send_file(method, path, data, filename)