I would like to develop a python script to download all live games in progress, particularly I want to count user rankings so I can see a chart of when I have the best chance of getting games at different parts of the day.
My thoughts are to download the current list in progress every 10 minutes, build an array that counts the number of players at each K or Dan level and then work out the average per rank per hour over a 7 day period.
I have checked the docs again and it needs an auth token.
So far I have not managed to get my registered client / client secret to authorise.
I have raised various queries but have not seen any answers.
I’m not sure how to code the OGSClient to use a event handler for the sockets.
I have had a look at the example code.
What I dont understand is how I setup the socket and handler and then keep the python code running so that the handler gets called while the code keeps running.
Do I just do something like
ogs.socket_connect(ogs_event_handler)
sleep(1 hour) # allow handler to be called
ogs.socket_disconnect()
You can probably do something like ogs.sock.wait(). Most socket libraries provide a way to run the event loop. But i just realized that library OGSClient is using socket.io. OGS moved away from that. You should open a bug report if you run into issues, or you may have better luck using the built-in websockets library.
keep in mind, this is a Go forum. For general Python questions like “how to wait for a socket response” you’ll probably be better served by asking StackOverflow or LLM or a Python-centric forum