Ejemplo n.º 1
0
    def post(self, params, required_fields, **kwargs):

        body_data = {key: value for (key, value) in required_fields.items()}

        if kwargs:
            body_data.update({key: value for (key, value) in kwargs.items()})

        resp_ok, resp_status, resp_data = self.__request('POST', params=params, body=body_data)
        if resp_ok and resp_status == 201:
            return resp_data
        else:
            raise exceptions.CreateException(resp_data)
Ejemplo n.º 2
0
    def post(self, params, required_fields, **kwargs):
        if self.auth:
            raise exceptions.AuthException(
                'With basic auth the API is not writable')
        body_data = {key: value for (key, value) in required_fields.items()}

        if kwargs:
            body_data.update({key: value for (key, value) in kwargs.items()})

        resp_ok, resp_status, resp_data = self.__request('POST',
                                                         params=params,
                                                         body=body_data)

        if resp_ok and resp_status == 201:
            return True
        else:
            raise exceptions.CreateException(resp_data)