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

check_rate_limit can fail if getStatus does not return any results #117

Closed
cheops opened this issue Dec 26, 2021 · 5 comments
Closed

check_rate_limit can fail if getStatus does not return any results #117

cheops opened this issue Dec 26, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@cheops
Copy link
Contributor

cheops commented Dec 26, 2021

check_rate_limit uses the url = "https://pvoutput.org/service/r2/getstatus.jsp" (and also wrongly uses the default _call method=requests.post)
but this can return an error, from the documentation:

Use the d parameter to request a specific date. When date is omitted, the last known live data in the last 7 days will be used.
A Bad request 400: No status found
No live data found on a specified date or no live data reported in the last 7 days when no date parameter is used.

the Get System Service with the method requests.get seems a safer bet

          url = "https://pvoutput.org/service/r2/getsystem.jsp"
          response = self._call(url, {}, headers=headers, method=requests.get)
yaleman added a commit that referenced this issue Dec 27, 2021
@yaleman
Copy link
Owner

yaleman commented Dec 27, 2021

@cheops I've updated the package to 0.0.6 in pypi with the suggested fixes, thanks!

@yaleman yaleman self-assigned this Dec 27, 2021
@yaleman yaleman added the bug Something isn't working label Dec 27, 2021
@yaleman
Copy link
Owner

yaleman commented Dec 27, 2021

Ok, I broke 0.0.6 on pypi, something about how I built the package - I'll fix it shortly in 0.0.7

@yaleman
Copy link
Owner

yaleman commented Dec 27, 2021

0.0.7's out and works 😄

@cheops
Copy link
Contributor Author

cheops commented Dec 27, 2021

works fine!

@cheops cheops closed this as completed Dec 27, 2021
@yaleman
Copy link
Owner

yaleman commented Dec 27, 2021

Thanks again for the report 👍🏻

yaleman added a commit that referenced this issue Dec 30, 2021
* cleaning up docs generation

* getstatus works

* adding more tests

* closes #117, fix check_rate_limit

* updated package to 0.0.6

* moving to flit for build

* removing pipfile

* removing old scripts

* updated for flit build

* updated README

* removing setup.py

* fixing typo per @cheops PR

* fixing README link

* fixing pyproject per @cheops PR

* fixing some code smells

* removing travis logo

* fixing handling of errors

* working around CI

* added missing flit

* added missing flit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants