GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — api/examples/subscribe_all_card_updates.py at master · sorare/api

Expand file tree

/

subscribe_all_card_updates.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
54 lines (44 loc) · 1.19 KB
/

subscribe_all_card_updates.py

Copy path

File metadata and controls

54 lines (44 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import websocket
import json
import time
w_socket = 'wss://ws.sorare.com/cable'
identifier = json.dumps({"channel": "GraphqlChannel"})
subscription_query = {
"query": "subscription { anyCardWasUpdated { slug } }",
"variables": {},
"action": "execute"
}
def on_open(ws):
subscribe_command = {"command": "subscribe", "identifier": identifier}
ws.send(json.dumps(subscribe_command).encode())
time.sleep(1)
message_command = {
"command": "message",
"identifier": identifier,
"data": json.dumps(subscription_query)
}
ws.send(json.dumps(message_command).encode())
def on_message(ws, data):
message = json.loads(data)
type = message.get('type')
if type == 'welcome':
pass
elif type == 'ping':
pass
elif message.get('message') is not None:
print(message['message'])
def on_error(ws, error):
print('Error:', error)
def on_close(ws, close_status_code, close_message):
print('WebSocket Closed:', close_message, close_status_code)
def long_connection():
ws = websocket.WebSocketApp(
w_socket,
on_message=on_message,
on_close=on_close,
on_error=on_error,
on_open=on_open
)
ws.run_forever()
if __name__ == '__main__':
long_connection()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.