Skip to content

Steam API example #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 31, 2023
Merged

Steam API example #129

merged 6 commits into from
Mar 31, 2023

Conversation

DJDevon3
Copy link
Contributor

@DJDevon3 DJDevon3 commented Mar 9, 2023

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

DJDevon3 added 3 commits March 9, 2023 15:23
Example displays the sum total amount of time in hours and days playing video games on steam.
python -m black requests_api_steam.py
@tekktrik tekktrik requested a review from a team March 13, 2023 17:45
@tekktrik
Copy link
Member

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

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and functionality look good to me.

I think it would be good to add a comment or two with info about how to get a steam API key and how to find the steam ID for your user account. Google got me to both items, but a point in the right direction from a comment in the example would be helpful.

I wish that their API returned more plain text rather than ID links to other objects. It'd be interesting to see the breakdown of game titles with hours played for each, but it seems like it'd require additional calls into their API to match up IDs to game titles.

I don't think it matters too much for this example, but during testing I found that the API omits free games from the results. This SO post shows a URL param that can be added to include them. Which in my case means the scary number that came out the first time wasn't even the real number, it got much scarier once it included the stats for one of my highest played games =x

@DJDevon3
Copy link
Contributor Author

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.

Added URLs for developer docs. Request now pulls all free games too.
split up long lines
have to run black EVERY time a file changes??
@DJDevon3
Copy link
Contributor Author

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

@DJDevon3
Copy link
Contributor Author

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
Copy link
Contributor Author

DJDevon3 commented Mar 21, 2023

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

Requested changes made and committed.

@DJDevon3
Copy link
Contributor Author

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

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I re-tested the latest version on a Feather ESP32-S2 TFT.

Thank you @DJDevon3!

@FoamyGuy FoamyGuy merged commit 6dd6dee into adafruit:main Mar 31, 2023
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants