Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit ca66169

Browse files
committed
only emit one warning
1 parent 944bf4d commit ca66169

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

google/auth/crypt/_cryptography_rsa.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@
4949

5050
def _warn_rsa_type(key_type):
5151
global _RSA_DEPRECATION_WARNED
52-
deprecation_msg = (
53-
"The 'rsa' library is deprecated and unmaintained. Support for "
54-
f"{key_type.__module__}.{key_type.__name__} keys will be removed in a future release. Please migrate to "
55-
"'cryptography' keys or use the '.from_string()' factory method."
56-
)
57-
warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=3)
58-
_RSA_DEPRECATION_WARNED = True
52+
if not _RSA_DEPRECATION_WARNED:
53+
deprecation_msg = (
54+
"The 'rsa' library is deprecated and unmaintained. Support for "
55+
f"{key_type.__module__}.{key_type.__name__} keys will be removed in a future release. Please migrate to "
56+
"'cryptography' keys or use the '.from_string()' factory method."
57+
)
58+
warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=3)
59+
_RSA_DEPRECATION_WARNED = True
5960

6061

6162
class RSAVerifier(base.Verifier):

0 commit comments

Comments
 (0)