adafruit / Adafruit_CircuitPython_Requests

Requests-like interface for web interfacing
MIT License
51 stars 37 forks source link

Add Premiere League Fantasy API Example #165

Closed DJDevon3 closed 6 months ago

DJDevon3 commented 6 months ago

Pulls total amount of players currently playing Premiere League Fantasy. Very basic example. The API json is massive. Enable debug at your own risk, it will likely crash any microcontroller. Added Connection Manager to work in tandem with adafruit_json_stream. This the first API example of Connection Manager that uses adafruit_json_stream.

Because the default JSON response is so large something like adafruit_json_stream with its iteration ability does help a little.

This API example was a request on the Adafruit Forums in November of 2023. I created the example but never added it to the API examples repo.

Serial output example:

Connecting to WiFi...
✅ Wifi!
 | Attempting to GET Premiere League JSON!
 | ✅ Premiere League JSON!
 | Total Premiere League Players: 10765624
✂️ Disconnected from Premiere League

Finished!
Board Uptime: 276662.0
Next Update: 15 minutes
===============================