Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /