adafruit / Adafruit_CircuitPython_Requests

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

Steam API example #129

Closed DJDevon3 closed 1 year ago

DJDevon3 commented 1 year ago

API example displays the sum total amount of time in hours and days playing video games on steam.

tekktrik commented 1 year ago

I can take a look at this in a couple days, if no one does prior.

DJDevon3 commented 1 year ago

That makes a lot of sense why my total game # was different from the amount of game titles it returned. Added &include_played_free_games=1 to the URL and instantly returned every game. That completely solved the discrepancy which I did notice and baffled me. Thanks!

As for showing time played for every title that's absolutely possible and rather easy. I bypassed that for the harder challenge which was taking every single game it spit out and summed the total time played from every game.

Like I said in the meeting, if you play a lot of games you might not want to see that number. 😆

Added URL's to the API docs and key at least where it resides for now. One thing I've learned about API's is they'll change URL's sometimes so do you include it or not. At least they'll work for the time being. Submitting changes in a commit/PR.

DJDevon3 commented 1 year ago

pylint & black hate me. looks like that one went through.

DJDevon3 commented 1 year ago

Without free games included

Attempting to GET STEAM Stats!
===============================
Total Games:  153
Total Hours: 5286.65
Total Days: 220.277
Monotonic:  2299.87

Finished!
Next Update in 15 minutes

With free games included

Attempting to GET STEAM Stats!
===============================
Total Games:  156
Total Hours: 5320.8
Total Days: 221.7
Monotonic:  2379.57

Finished!
Next Update in 15 minutes
===============================
DJDevon3 commented 1 year ago

What would be truly scary is adding all of the games cost and spitting out a dollar amount. 😨

Requested changes made and committed.

DJDevon3 commented 1 year ago

@tekktrik or @FoamyGuy Should be ready for another review or do I need to do something else?