@ankit_anmol, It isn’t working!

import requests
import ast
import socketio

sio = socketio.Client(logger=True)

token = 'my token'

@sio.on('updateMessageCount')
def onMessage():
    messagecountreq = requests.get('https://api.wasteof.money/messages/count')
    if messagecountreq.text.get('count') == "0":
        exit()
    req = requests.get('https://api.wasteof.money/messages/unread', headers = {'Authorization': token})
    message = req.json()["unread"][0]
    messageID = message.get('_id')
    post = requests.post(f"https://api.wasteof.money/users/wombucks/wall", headers = {"Authorization": token}, json={"content": "Okay", "parent":messageID})
    
sio.connect("https://api.wasteof.money/", auth= {"token" : token})

Traceback (most recent call last):
  File "C:\Users\drewm\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in bootstrapinner
self.run()
File "C:\Users\drewm\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\drewm\AppData\Local\Programs\Python\Python39\lib\site-packages\socketio\client.py", line 705, in handleeio_message
self._handle_event(pkt.namespace, pkt.id, pkt.data)
File "C:\Users\drewm\AppData\Local\Programs\Python\Python39\lib\site-packages\socketio\client.py", line 581, in handleevent
r = self._trigger_event(data[0], namespace, *data[1:])
File "C:\Users\drewm\AppData\Local\Programs\Python\Python39\lib\site-packages\socketio\client.py", line 629, in triggerevent
return self.handlers[namespace][event](*args)
TypeError: onMessage() takes 0 positional arguments but 1 was given
Jun 26, 2022, 12:40 AM
1 0 15

comments (single view)

I might just do what I said in another comment, though it isn’t that efficient

View all comments