__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Copyright 2016 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """Google Auth Library for Python."""
  15. import logging
  16. import sys
  17. import warnings
  18. from google.auth import version as google_auth_version
  19. from google.auth._default import (
  20. default,
  21. load_credentials_from_dict,
  22. load_credentials_from_file,
  23. )
  24. __version__ = google_auth_version.__version__
  25. __all__ = ["default", "load_credentials_from_file", "load_credentials_from_dict"]
  26. class Python37DeprecationWarning(DeprecationWarning): # pragma: NO COVER
  27. """
  28. Deprecation warning raised when Python 3.7 runtime is detected.
  29. Python 3.7 support will be dropped after January 1, 2024.
  30. """
  31. pass
  32. # Checks if the current runtime is Python 3.7.
  33. if sys.version_info.major == 3 and sys.version_info.minor == 7: # pragma: NO COVER
  34. message = (
  35. "After January 1, 2024, new releases of this library will drop support "
  36. "for Python 3.7."
  37. )
  38. warnings.warn(message, Python37DeprecationWarning)
  39. # Set default logging handler to avoid "No handler found" warnings.
  40. logging.getLogger(__name__).addHandler(logging.NullHandler())