Messenger_back_database / test_gating.py
Nrighton233j
Fix missing time import causing stickers/packs 500 error
a0e7c0e
Raw
History Blame Contribute Delete
819 Bytes
import socketio
import time
TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsInVzZXJuYW1lIjoidGVzdHVzZXIiLCJpYXQiOjE3ODMyNzk5NjksImV4cCI6MTc4NTg3MTk2OX0.gpgvpMgEumttey9egOV1UIrk7EGyandoYeRX6gpCckA"
BASE_URL = "https://Brighton233j-Messenger-back-database.hf.space"
sio = socketio.Client()
@sio.event
def connect():
print("Connected as testuser! Sending to stranger_test (id 7)...")
sio.emit("send_message", {
"token": TOKEN,
"recipient_id": 7,
"content": "Hey, we're not friends yet — this should be a request"
})
@sio.on("new_message")
def on_message(data):
print(f"[msg] is_request={data.get('is_request')} content={data['content']}")
sio.connect(f"{BASE_URL}?token={TOKEN}", socketio_path="/socket.io", transports=["websocket"])
time.sleep(4)
sio.disconnect()