Skip to content
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

Update Rachio example with Rate Limit endpoints, fixed 1700 daily requests #196

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

DJDevon3
Copy link
Contributor

After adding the rate limiting endpoints to I realized making 2 requests per iteration cut down the total daily calls from 1700 to 850. By forcing a user to first get the PERSONID and paste it into settings.toml that allows for a true 1700 limit by making 1 request per run instead of 2. I never came remotely close to approaching 850 per day but if a user reads the Rachio API documentation they'll be expecting to have 1700 requests per day at their disposal, this fixes that.

I tried to somewhat automate the process. The first run will only show the PersonID and instruct the user to paste the ID/Token into Settings.toml. After that is done then it will ignore the first request every iteration.

The reason for the 'if RACHIO_PERSONID is None or RACHIO_PERSONID == "":' is because sometimes settings.toml would return None and sometimes it returns blank. I'm not sure why that is but having both conditionals solved it. The script is expecting 'RACHIO_PERSONID = ""' to be in settings.toml as a blank env on first run.

@FoamyGuy this isn't something that should be done on Stream as the PersonID is now visible in serial unobfuscated as part of the process. There's really no way around it unless I automated it to be stored in NVM and I didn't feel like going that route for this one.

Because I was making 2 calls per request it cut down the total daily calls from 1700 to 850. By forcing a user to first get the PERSONID and paste it into settings.toml that allows for a true 1700 limit by making 1 request per run instead of 2.
@DJDevon3 DJDevon3 changed the title Update with Rate Limit endpoints, fix so all 1700 daily calls are available. Update Rachio example with Rate Limit endpoints, fixed 1700 daily requests Jun 28, 2024
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. Thank you.

@FoamyGuy FoamyGuy merged commit 4b55319 into adafruit:main Jun 30, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 1, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_VEML6075 to 1.1.18 from 1.1.17:
  > Merge pull request adafruit/Adafruit_CircuitPython_VEML6075#19 from mkarpiarz/fix-api-docs-formatting

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 4.1.2 from 4.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#196 from DJDevon3/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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.

2 participants