Skip to content

Commit a14ca32

Browse files
authored
Add rate limiting exceptions. (#695)
1 parent 7dbe278 commit a14ca32

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

firebase_admin/_auth_utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,20 @@ def __init__(self, message, cause=None, http_response=None):
405405
exceptions.InvalidArgumentError.__init__(self, message, cause, http_response)
406406

407407

408+
class TooManyAttemptsTryLaterError(exceptions.ResourceExhaustedError):
409+
"""Rate limited because of too many attempts."""
410+
411+
def __init__(self, message, cause=None, http_response=None):
412+
exceptions.ResourceExhaustedError.__init__(self, message, cause, http_response)
413+
414+
415+
class ResetPasswordExceedLimitError(exceptions.ResourceExhaustedError):
416+
"""Reset password emails exceeded their limits."""
417+
418+
def __init__(self, message, cause=None, http_response=None):
419+
exceptions.ResourceExhaustedError.__init__(self, message, cause, http_response)
420+
421+
408422
_CODE_TO_EXC_TYPE = {
409423
'CONFIGURATION_NOT_FOUND': ConfigurationNotFoundError,
410424
'DUPLICATE_EMAIL': EmailAlreadyExistsError,
@@ -417,6 +431,8 @@ def __init__(self, message, cause=None, http_response=None):
417431
'PHONE_NUMBER_EXISTS': PhoneNumberAlreadyExistsError,
418432
'TENANT_NOT_FOUND': TenantNotFoundError,
419433
'USER_NOT_FOUND': UserNotFoundError,
434+
'TOO_MANY_ATTEMPTS_TRY_LATER': TooManyAttemptsTryLaterError,
435+
'RESET_PASSWORD_EXCEED_LIMIT': ResetPasswordExceedLimitError,
420436
}
421437

422438

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy