From 7d16a4470a3ce98fa98ab6ade8ef8bb25ad0253f Mon Sep 17 00:00:00 2001 From: zmoon Date: Thu, 19 Sep 2024 11:56:29 -0500 Subject: [PATCH] API key notes in module docstring --- monetio/obs/openaq.py | 1 + monetio/obs/openaq_v2.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/monetio/obs/openaq.py b/monetio/obs/openaq.py index 56dcaa7e..9ca08601 100644 --- a/monetio/obs/openaq.py +++ b/monetio/obs/openaq.py @@ -1,6 +1,7 @@ """Get v1 (government-only) OpenAQ data from AWS. https://openaq.org/ + https://openaq-fetches.s3.amazonaws.com/index.html """ diff --git a/monetio/obs/openaq_v2.py b/monetio/obs/openaq_v2.py index 889db5eb..d709f3c5 100644 --- a/monetio/obs/openaq_v2.py +++ b/monetio/obs/openaq_v2.py @@ -1,5 +1,14 @@ """Get AQ data from the OpenAQ v2 REST API. +Visit https://docs.openaq.org/docs/getting-started to get an API key +and set environment variable ``OPENAQ_API_KEY`` to use it. + +For example, in Bash: + +.. code-block:: bash + + export OPENAQ_API_KEY="your_api_key_here" + https://openaq.org/ https://api.openaq.org/docs#/v2 @@ -60,8 +69,8 @@ def _api_key_warning(func): def wrapper(*args, **kwargs): if API_KEY is None: warnings.warn( - "Non-cached requests to the OpenAQ v2 web API will be slow without an API key, " - "or might fail (HTTP error 401). " + "Non-cached requests to the OpenAQ v2 web API will be slow without an API key " + "or requests will fail (HTTP error 401). " "Obtain one (https://docs.openaq.org/docs/getting-started#api-key) " "and set your OPENAQ_API_KEY environment variable.", stacklevel=2,