def bson_jwt_call(self, function_name, deserializer=None, url_params={}, data=None, headers=None, response=None, timeout=None): # If we dont have token, send without jwtauth (anonymous) logger.debug("JWT Call %s" % str(function_name)) auth = JWTAuth(self.token) if self.token else None headers = headers or {} headers.update(self.custom_headers) headers['Content-Type'] = 'application/bson' if data is not None: data = str(encode_bson(data)) return self.call(function_name, url_params=url_params, data=data, headers=headers, auth=auth, deserializer=deserializer, response=response, timeout=timeout)
def abort_with_bson(self, code, data): data = encode_bson(data) res = HTTPResponse(status=code, body=data) self._set_bson_content_type_headers(res) #abort(code, data) return res
def response_bson(self, data): self._set_bson_content_type_headers(response) return encode_bson(data)