Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. async def test_websocket(aiohttp_client, loop):
  2.     app = web.Application()
  3.     app.router.add_get('/', index)
  4.     client = await aiohttp_client(app)
  5.     headers = {'Authorization': 'Token bG912312n3aasdW46cGFzcw=='}
  6.     resp = await client.ws_connect('/', headers=headers)
  7.  
  8. # в сокете вот так вывожу
  9. pprint(ws_current.headers)
  10. pprint(ws_current.get('Authorization'))
  11.  
  12. # получаю
  13. """
  14. <CIMultiDict('Upgrade': 'websocket', 'Connection': 'upgrade', 'Sec-WebSocket-Accept': '+m42KK2222Q9SkaxOLqDCUvu4bo=', 'Content-Type': 'application/octet-stream', 'Date': 'Sat, 22 Feb 2020 07:39:02 GMT', 'Server': 'Python/3.7 aiohttp/3.6.2')>
  15. None
  16. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement