def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) session_factory = CookieSessionFactory(secret_key=b'secret', cookie_name='test_cookie', dumps=json.dumps, loads=json.loads, loop=self.loop) self.server = RESTServer(debug=True, keep_alive=75, hostname='localhost', session_factory=session_factory, loop=self.loop) rest = REST(self) self.server.add_url('GET', '/init', rest.init_session, use_request='req') self.server.add_url('GET', '/get', rest.get_from_session, use_request='req') self.server.add_url('GET', '/counter', rest.counter, use_request='req') self.server.add_url('GET', '/counter/{start}', rest.counter, use_request='req')
def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) self.server = RESTServer(debug=True, keep_alive=75, hostname='127.0.0.1', loop=self.loop) self.port = None rest = REST(self) self.server.add_url('POST', '/post/{id}', rest.func_POST, use_request=True) self.server.add_url('POST', '/create/', rest.func_POST_code) self.server.add_url('GET', '/post/{id}', rest.func_GET, use_request='req') self.server.add_url('GET', '/post/{id}/2', rest.func_GET2, use_request='req') self.server.add_url('GET', '/cookie/{value}', rest.coro_set_cookie, use_request='req') self.server.add_url('GET', '/get_cookie/', rest.func_get_cookie, use_request='req')
def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) self.server = RESTServer(debug=True, hostname='localhost', enable_cors=True) add_url = self.server.add_url rest = REST(self) add_url('GET', '/', rest.index) add_url('GET', '/check_origin', rest.check_origin, cors_options={'allow-origin': 'http://example.com/'})
def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) auth_policy = DictionaryAuthorizationPolicy({'chris': ('read', )}) self.server = RESTServer(debug=True, keep_alive=75, hostname='127.0.0.1', identity_policy=CookieIdentityPolicy(), auth_policy=auth_policy) self.port = None rest = REST() self.server.add_url('GET', '/auth/{permission}', rest.handler)
def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) self.server = RESTServer(debug=True, keep_alive=75, hostname='127.0.0.1') self.port = None rest = REST(self) self.server.add_url('POST', '/post/{id}', rest.func_POST) self.server.add_url('POST', '/create', rest.create) self.server.add_url('GET', '/post/{id}', rest.func_GET) self.server.add_url('GET', '/post/{id}/2', rest.func_GET2) self.server.add_url('GET', '/cookie/{value}', rest.coro_set_cookie) self.server.add_url('GET', '/get_cookie/', rest.func_get_cookie) self.server.add_url('GET', '/check/no/session', rest.check_session)
def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) self.server = RESTServer(hostname='example.com', loop=self.loop)