Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 656

Send headers in Websockets connection request from Python client

$
0
0

What is the correct method / syntax for adding headers to a websocket connection request using Python Websockets ?

The server I'm trying to connect to requires headers in the connection request for authentication

async def connect():    async with websockets.connect("wss://site.com/ws") as websocket:        response = await websocket.recv()        print(response)    # eg. does not work:    async with websockets.connect(f"wss://site.com/ws, header={headers}") as websocket:    async with websockets.connect(f"wss://site.com/ws, extra_headers:{headers}") as websocket:

Similar question was asked here but did not answer the core of the question: How to send 'Headers' in websocket python


Viewing all articles
Browse latest Browse all 656

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>