-
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathorig_headers.py
More file actions
29 lines (24 loc) · 633 Bytes
/
Copy pathorig_headers.py
File metadata and controls
29 lines (24 loc) · 633 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import asyncio
import wreq
from wreq.emulation import Emulation
async def main():
ws = await wreq.websocket(
"wss://gateway.discord.gg/",
emulation=Emulation.Chrome137,
headers={"Origin": "https://discord.com"},
# Preserve HTTP/1 case and header order
orig_headers=[
"User-Agent",
"Origin",
"Host",
"Accept",
"Accept-Encoding",
"Accept-Language",
],
)
msg = await ws.recv()
if msg is not None:
print(msg.json())
await ws.close()
if __name__ == "__main__":
asyncio.run(main())