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
covidcast package updates for API keys #618
Conversation
448b8d3
to
34b6b15
Compare
34b6b15
to
ce11af0
Compare
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.
Fill constants in python docs, update language
0442d9a
to
a630c87
Compare
a630c87
to
178b283
Compare
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.
A few small tweaks to make, I think
@@ -104,6 +104,15 @@ May 1st were updated on May 23rd based on new data, giving a ``lag`` of 22 days. | |||
See the :py:func:`covidcast.signal` documentation for details on the returned | |||
data frame. | |||
|
|||
By default, this package submits queries to the API anonymously. If you have an | |||
API key, you can use it with this package by calling | |||
:py:func:`covidcast.use_api_key`, then call fetch functions as normal: |
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.
This will cross-reference with a link to the covidcast.use_api_key
docs, but those docs aren't actually included in Sphinx anywhere. Probably we want to add an "API keys" section to signals.rst
, containing .. autofunction: covidcast.use_api_key
, right?
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.
Done
.. warning :: By default, this package submits queries to the API | ||
anonymously. All the examples in the package documentation are compatible | ||
with anonymous use of the API, but `there are some limits on anonymous | ||
queries <https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html>`_ | ||
which do not apply if you use an API key to authenticate your queries. If you | ||
regularly or frequently use our system, please consider `registering for a | ||
free API key <https://forms.gle/hkBr5SfQgxguAfEt7>`_ even if your usage falls | ||
within the anonymous usage limits. API key usage helps us understand who and | ||
how others are using our Delphi Epidata API, which may in turn inform our | ||
future research, data partnerships, and funding. As we are a research group, | ||
our server resources are limited and cannot support high-volume interactive | ||
use (with or without an API key). If you use data from the COVIDcast Epidata | ||
API to power a public product, dashboard, app, or other service, please | ||
download the data you need and store it centrally rather than making API | ||
requests for every user. |
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.
Once we have covidcast.use_api_key
in signals.rst
, we could edit this to refer to that, so people see in one place (a) how to register and (b) how to use the keys. Currently this message says how to register but not how to actually use the key you get
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.
Done; also split off "please don't hammer our server" into a separate paragraph
httr::stop_for_status(response, task = "fetch data from API") | ||
msg <- "fetch data from API" | ||
if (is.na(auth)) { | ||
msg <- paste(msg, "anonymously") |
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.
In the future, if we want to nag people harder to register, we could use rlang::inform with .frequency = "once"
so they get a message once per session telling them they ought to register. It could be guarded by the same is.na(auth)
here
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.
hmmm we aren't nagging anyone anywhere else, but this is good to keep in mind for the future
Co-authored-by: Alex Reinhart <areinhar@stat.cmu.edu>
Co-authored-by: Alex Reinhart <areinhar@stat.cmu.edu>
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.
Looks good to me, modulo one tiny nitpick
Co-authored-by: Alex Reinhart <areinhar@stat.cmu.edu>
Preparing changes to be released before rollout of Epidata API Keys.
This PR makes the following changes:
use_api_key
as a pass-through to the delphi-epidata python client, which handles keys through a class membergetOptions
Checklist from draft mode