def post(self, endpoint, process_response=True, files=None, **params):
        """
        Performs an HTTP POST to the specified endpoint (API path),
            passing parameters if given.
        The api_version is prepended to the endpoint,
            if it was specified when the Trovebox object was created.

        Returns the decoded JSON dictionary, and raises exceptions if an
            error code is received.
        Returns the raw response if process_response=False
        """
        params = self._process_params(params)
        url = self._construct_url(endpoint)

        if not self.auth.consumer_key:
            raise TroveboxError("Cannot issue POST without OAuth tokens")

        auth = requests_oauthlib.OAuth1(self.auth.consumer_key,
                                        self.auth.consumer_secret,
                                        self.auth.token,
                                        self.auth.token_secret)
        with requests.Session() as session:
            session.verify = self.config["ssl_verify"]
            if files:
                # Need to pass parameters as URL query, so they get OAuth signed
                response = session.post(url, params=params,
                                        files=files, auth=auth)
            else:
                # Passing parameters as URL query doesn't work
                # if there are no files to send.
                # Send them as form data instead.
                response = session.post(url, data=params, auth=auth)

        self._logger.info("============================")
        self._logger.info("POST %s" % url)
        self._logger.info("params: %s" % repr(params))
        if files:
            self._logger.info("files:  %s" % repr(files))
        self._logger.info("---")
        self._logger.info(response.text[:1000])
        if len(response.text) > 1000: # pragma: no cover
            self._logger.info("[Response truncated to 1000 characters]")

        self.last_url = url
        self.last_params = params
        self.last_response = response

        if process_response:
            return self._process_response(response)
        else:
            if 200 <= response.status_code < 300:
                return response.text
            else:
                raise TroveboxError("HTTP Error %d: %s" %
                                    (response.status_code, response.reason))
dataset/ETHPy150Open photo/openphoto-python/trovebox/http.py/Http.post/original