-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add Current User info methods #127
Conversation
👋 Thanks for this pull request! Unfortunately, it looks like the automated continuous integration (CI) test(s) failed. These can be tricky to fix so we've written a guide on how to fix them locally. It has pages about running pre-commit locally and another about building the docs locally with sphinx. Thanks for contributing to CircuitPython! If you have more questions, feel free to join the Adafruit Discord and post in #circuitpython-dev. |
cb21c07
to
ab2f696
Compare
@brentru this is ready for review |
I was unkeen on get throttle limit as it returns a lot more, also when I
added the example output it caused no end of pylint issues so I removed it.
I'll have another go
…On Fri, 9 Aug 2024 at 19:53, Brent Rubell ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In adafruit_io/adafruit_io.py
<#127 (comment)>
:
> @@ -855,6 +855,23 @@ def receive_random_data(self, generator_id: int):
path = self._compose_path("integrations/words/{0}".format(generator_id))
return self._get(path)
+ def receive_user_info(self):
+ """
+ Get detailed account information for the current user.
+
+ See https://io.adafruit.com/api/docs/#get-user-info
+ """
+ return self._get("https://io.adafruit.com/api/v2/user")
+
+ def receive_user_rate_info(self):
If we don't include this as an example, please add example output to the
docstring so people know roughly what will happen when they call this method
------------------------------
In adafruit_io/adafruit_io.py
<#127 (comment)>
:
> @@ -855,6 +855,23 @@ def receive_random_data(self, generator_id: int):
path = self._compose_path("integrations/words/{0}".format(generator_id))
return self._get(path)
+ def receive_user_info(self):
+ """
+ Get detailed account information for the current user.
+
+ See https://io.adafruit.com/api/docs/#get-user-info
+ """
+ return self._get("https://io.adafruit.com/api/v2/user")
+
+ def receive_user_rate_info(self):
maybe get_throttle_limit instead
—
Reply to this email directly, view it on GitHub
<#127 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTBZ44ABVB2BZ7V7NSL5RDZQUFZJAVCNFSM6AAAAABMAPAH36VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEMZQHA2TOMBRGQ>
.
You are receiving this because you authored the thread.Message ID:
<adafruit/Adafruit_CircuitPython_AdafruitIO/pull/127/review/2230857014@
github.com>
|
Would it be able to return an |
Now renamed the functions to use the get prefix instead of receive. |
@brentru ready for re-review |
Spotted I'd not noticed CI was passing two commits before (I was just trying to please Sphynx) so dropped last two commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…limit and get_remaining_throttle_limit Return User Usage Limits / Current Usage towards Throttle Limits with `get_user_rate_info` Return full account info with `get_user_info` Fixes #126
acf508e
to
3eed948
Compare
Example added as part of testing before merge. Closing out |
Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 5.10.0 from 5.9.0: > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#127 from adafruit/tyeth/issue126 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Adds two new methods related to returning the current users info. One for the complete user info, and one just for the throttle/auth/sms rates+limits
Return User Usage Limits / Current Usage towards Throttle Limits with
receive_user_rate_info
Return full account info with
receive_user_info
Fixes #126