def get_with_bearer(self, path, bearer, callback=None): request = Request() request.destination = self.server request.code = defines.Codes.GET.number request.uri_path = path request.bearer = bearer #request.token = generate_random_token(5) if callback is not None: thread = threading.Thread(target=self._thread_body, args=(request, callback)) thread.start() else: self.protocol.send_message(request) response = self.queue.get(block=True) return response
def introspect(self, path, bearer, callback=None, access_path=None): request = Request() request.destination = self.server request.code = defines.Codes.GET.number request.uri_path = path request.bearer = bearer # request.token = generate_random_token(5) # request.observe = 0 request.token_type_hint = "code" request.scope = access_path if callback is not None: thread = threading.Thread(target=self._thread_body, args=(request, callback)) thread.start() else: self.protocol.send_message(request) response = self.queue.get(block=True) return response