|
22 | 22 | API_KEY_SOFT_WARNING = API_KEY_HARD_WARNING - timedelta(days=14)
|
23 | 23 |
|
24 | 24 | # rollout warning messages
|
25 |
| -# intended usage: in place of API_KEY_WARNING_TEXT |
26 |
| -# phase 1 / soft warning: ROLLOUT_WARNING_RATE_LIMIT or ROLLOUT_WARNING_MULTIPLES |
27 |
| -# phase 2 / hard warning: (ROLLOUT_WARNING_RATE_LIMIT + PHASE_2_STOPGAP) or (ROLLOUT_WARNING_MULTIPLES + PHASE_2_STOPGAP) |
28 |
| - |
29 |
| -ROLLOUT_WARNING_RATE_LIMIT = "This request exceeded the anonymous limit on requests per minute." |
30 |
| -ROLLOUT_WARNING_MULTIPLES = "This request exceeded the anonymous limit on selected multiples." |
31 |
| -_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_LOCAL |
33 |
| -) |
| 25 | +ROLLOUT_WARNING_RATE_LIMIT = "This request exceeded the rate limit on anonymous requests, which will be enforced starting {}.".format(API_KEY_REQUIRED_STARTING_AT) |
| 26 | +ROLLOUT_WARNING_MULTIPLES = "This request exceeded the anonymous limit on selected multiples, which will be enforced starting {}.".format(API_KEY_REQUIRED_STARTING_AT) |
| 27 | +_ROLLOUT_WARNING_AD_FRAGMENT = "To be exempt from this limit, authenticate your requests with a free API key, now available at {}.".format(API_KEY_REGISTRATION_FORM_LINK_LOCAL) |
34 | 28 |
|
35 |
| -PHASE_1_2_STOPGAP = ( # todo: add temporary key |
| 29 | +PHASE_1_2_STOPGAP = ( |
36 | 30 | "A temporary public key `{}` is available for use between now and {} to give you time to register or adapt your requests without this message continuing to break your systems."
|
37 |
| -).format(TEMPORARY_API_KEY, API_KEY_REQUIRED_STARTING_AT) |
| 31 | +).format(TEMPORARY_API_KEY, (API_KEY_REQUIRED_STARTING_AT + timedelta(days=7))) |
38 | 32 |
|
39 | 33 |
|
40 | 34 | # 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_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) |
| 35 | +ERROR_MSG_RATE_LIMIT = "Rate limit exceeded for anonymous queries. To remove this limit, register a free API key at {}".format(API_KEY_REGISTRATION_FORM_LINK_LOCAL) |
| 36 | +ERROR_MSG_MULTIPLES = "Requested too many multiples for anonymous queries. To remove this limit, register a free API key at {}".format(API_KEY_REGISTRATION_FORM_LINK_LOCAL) |
43 | 37 | 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_LOCAL) |
| 38 | + "API key does not exist. Register a new key at {} or contact [email protected] to troubleshoot". format( API_KEY_REGISTRATION_FORM_LINK_LOCAL) |
45 | 39 | )
|
46 |
| -ERROR_MSG_INVALID_ROLE = "Provided API key does not have access to this endpoint, please contact $CONTACT_POINT." |
| 40 | +ERROR_MSG_INVALID_ROLE = "Provided API key does not have access to this endpoint. Please contact [email protected]." |
47 | 41 |
|
48 | 42 |
|
49 | 43 | def resolve_auth_token() -> Optional[str]:
|
|
0 commit comments