-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
37 lines (30 loc) · 819 Bytes
/
test.py
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
import spotify
import dotenv
import os
from filterdatadummy import print_json
dotenv.load_dotenv()
sp = spotify.Spotify(
access_token=os.getenv("TOKEN")
)
@sp.event
async def on_connection_verify(ctx :spotify.ConnectionVerify):
print_json(ctx.todict())
@sp.event
async def on_websocket_raw(ctx :spotify.WebsocketRaw):
print_json(ctx.todict())
@sp.event
async def on_websocket_ping(ctx :spotify.WebsocketPing):
print_json(ctx.todict())
@sp.event
async def on_user_interaction_raw(ctx :spotify.UserInteraction):
print_json(ctx.todict())
try:
sp.run()
except Exception as e:
error = {
"type": "error",
"error": list(e.args),
"error_type": type(e).__name__,
"error_module": type(e).__module__
}
print_json(error)