adafruit / Adafruit_CircuitPython_AdafruitIO

Adafruit IO for CircuitPython
http://io.adafruit.com
MIT License
49 stars 33 forks source link

Add Current User info methods #127

Closed tyeth closed 3 weeks ago

tyeth commented 2 months ago

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

github-actions[bot] commented 2 months ago

👋 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.

tyeth commented 2 months ago

@brentru this is ready for review

tyeth commented 2 months ago

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 https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO/pull/127#discussion_r1711994945 :

@@ -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)

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 https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO/pull/127#discussion_r1711995938 :

@@ -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)

maybe get_throttle_limit instead

— Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO/pull/127#pullrequestreview-2230857014, 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>

brentru commented 2 months ago

I was unkeen on get throttle limit as it returns a lot more

Would it be able to return an int or string? It'd be most useful returning something we could parse and use in a sketch to ensure the sketch abides by the limit.

tyeth commented 2 months ago

Now renamed the functions to use the get prefix instead of receive. Added convenience functions to request just throttle limit, or just usage, or finally the more helpful remaining throttle limit

tyeth commented 2 months ago

@brentru ready for re-review

tyeth commented 2 months ago

Spotted I'd not noticed CI was passing two commits before (I was just trying to please Sphynx) so dropped last two commits.

tyeth commented 3 weeks ago

Example added as part of testing before merge. Closing out