Query free badminton slots on www.myactivesg.com the easy way.
Currently to check availability on MyActiveSG, we have to select a particular activity, venue and date one-by-one. Although it works, it can be quite slow and annoying to have to do this for all the venues and dates we are interested in.
This tool checks the availability in the background for you. When it's done you can view the result on the web browser quickly.
- Python 3.6
Requests made by earlier versions of python seems to give such error:The server cannot understand the request.
Seems to have something to do with the encryption library or requests library of earlier Python - Python requests, crypto and BeautifulSoup libraries
For the crypto library, if installed using pip, normally it requires compilation from crypto source code and this requires you to setup Python development tools and so on. An easier way is to install Python distribution from Anaconda which already includes all the necessary libraries. - Google Maps API key (to view the result in the map). You can get it from here.
- Change directory to activesg
- Execute the following command:
python activesg.py -u <username>
- It will prompts you for password
Alternatively, if you don't want to always enter username and password. Put them in these environment variables:ACTIVESG_EMAIL
andACTIVESG_PASSWORD
. Then you can just executepython activesg.py
. - After it finished, you can stop the result. The result is stored in html/availability.json
- Edit html/index.html and replace
REPLACE_WITH_YOUR_API_KEY
with your Google Maps API key - You can go change directory to
html
folder then start a web server:python -m http.server 80