a gaming computer keyboard sitting on top of a desk
a gaming computer keyboard sitting on top of a desk

API interaction

Tools

python

requests

lxml

api + params

Discord

Raspberry Pi Zero

Screens

Approach

The initial request was to duplicate an existing subscription service which allowed users in a group chat to request their gaming statistics using keywords or commands in a common chat application.

I initially pulled these stats using Beautiful Soup from a free statistics website (with permission) and used these statistics to database statistics over time.

I was then able to get access to an API with a request agreement with the data-owner, which was negligible for them but perfect for myself and my users.

Using python I request data (requests.get) from the API and store these as values in python for 10 or so members of an e-sports team.

With a function and with Pandas, I tidy up the data and join the elements as strings to be used by the chat bot.

I use discord.py to create a bot which responds to commands which triggers the above processes and provides live data to the users containing either a single user or the full team.

I then transferred this script to a Raspberry Pi Zero which acts as a server for the bot, running headlessly, using Screens to run the script 24/7 so users can access their stats from Discord whenever they want to.

The data is also stored in a database which enables visualisation of statistics over time.