Skip to content

Commit 581c4d3

Browse files
committed
update api-key error messages to use local redirect to registration form
1 parent 1e35a09 commit 581c4d3

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/server/_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@
7777
RATELIMIT_STORAGE_URL = f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:6379"
7878

7979
API_KEY_REGISTRATION_FORM_LINK = "https://forms.gle/hkBr5SfQgxguAfEt7"
80-
# shortcut to "https://docs.google.com/forms/d/e/1FAIpQLSe5i-lgb9hcMVepntMIeEo8LUZUMTUnQD3hbrQI3vSteGsl4w/viewform?usp=sf_link"
80+
# ^ shortcut to "https://docs.google.com/forms/d/e/1FAIpQLSe5i-lgb9hcMVepntMIeEo8LUZUMTUnQD3hbrQI3vSteGsl4w/viewform?usp=sf_link"
81+
API_KEY_REGISTRATION_FORM_LINK_LOCAL = "https://api.delphi.cmu.edu/epidata/admin/registration_form"
82+
# ^ redirects to API_KEY_REGISTRATION_FORM_LINK
8183

8284
API_KEY_REMOVAL_REQUEST_LINK = "https://forms.gle/GucFmZHTMgEFjH197"
83-
# shortcut to "https://docs.google.com/forms/d/e/1FAIpQLSff30tsq4xwPCoUbvaIygLSMs_Mt8eDhHA0rifBoIrjo8J5lw/viewform"
85+
# ^ shortcut to "https://docs.google.com/forms/d/e/1FAIpQLSff30tsq4xwPCoUbvaIygLSMs_Mt8eDhHA0rifBoIrjo8J5lw/viewform"
86+
API_KEY_REMOVAL_REQUEST_LINK_LOCAL = "https://api.delphi.cmu.edu/epidata/admin/removal_request"
87+
# ^ redirects to API_KEY_REMOVAL_REQUEST_LINK

src/server/_security.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
API_KEY_REQUIRED_STARTING_AT,
1313
REDIS_HOST,
1414
REDIS_PASSWORD,
15-
API_KEY_REGISTRATION_FORM_LINK,
15+
API_KEY_REGISTRATION_FORM_LINK_LOCAL,
1616
TEMPORARY_API_KEY,
1717
URL_PREFIX,
1818
)
@@ -29,7 +29,7 @@
2929
ROLLOUT_WARNING_RATE_LIMIT = "This request exceeded the anonymous limit on requests per minute."
3030
ROLLOUT_WARNING_MULTIPLES = "This request exceeded the anonymous limit on selected multiples."
3131
_ROLLOUT_WARNING_AD_FRAGMENT = "To be exempt from this limit, authenticate your requests with an API key, which will be enforced starting {}. Registration now available at {}.".format(
32-
API_KEY_REQUIRED_STARTING_AT, API_KEY_REGISTRATION_FORM_LINK
32+
API_KEY_REQUIRED_STARTING_AT, API_KEY_REGISTRATION_FORM_LINK_LOCAL
3333
)
3434

3535
PHASE_1_2_STOPGAP = ( # todo: add temporary key
@@ -38,10 +38,10 @@
3838

3939

4040
# steady-state error messages
41-
ERROR_MSG_RATE_LIMIT = "Rate limit exceeded for anonymous queries.\nTo remove this limit, register a free API key at {}".format(API_KEY_REGISTRATION_FORM_LINK)
42-
ERROR_MSG_MULTIPLES = "Requested too many multiples for anonymous queries.\nTo remove this limit, register a free API key at {}".format(API_KEY_REGISTRATION_FORM_LINK)
41+
ERROR_MSG_RATE_LIMIT = "Rate limit exceeded for anonymous queries.\nTo remove this limit, register a free API key at {}".format(API_KEY_REGISTRATION_FORM_LINK_LOCAL)
42+
ERROR_MSG_MULTIPLES = "Requested too many multiples for anonymous queries.\nTo remove this limit, register a free API key at {}".format(API_KEY_REGISTRATION_FORM_LINK_LOCAL)
4343
ERROR_MSG_INVALID_KEY = (
44-
"API key does not exist. Register a new key at {} or contact $CONTACT_POINT to troubleshoot".format(API_KEY_REGISTRATION_FORM_LINK)
44+
"API key does not exist. Register a new key at {} or contact $CONTACT_POINT to troubleshoot".format(API_KEY_REGISTRATION_FORM_LINK_LOCAL)
4545
)
4646
ERROR_MSG_INVALID_ROLE = "Provided API key does not have access to this endpoint, please contact $CONTACT_POINT."
4747

0 commit comments

Comments
 (0)