import json
import platform
import sys
from . import __version__ as pyjwt_version
try:
import cryptography
except ModuleNotFoundError:
cryptography = None # type: ignore
def info():
"""
Generate information for a bug report.
Based on the requests package help utility module.
"""
try:
platform_info = {
"system": platform.system(),
"release": platform.release(),
}
except OSError:
platform_info = {"system": "Unknown", "release": "Unknown"}
implementation = platform.python_implementation()
if implementation == "CPython":
implementation_version = platform.python_version()
elif implementation == "PyPy":
implementation_version = "{}.{}.{}".format(
sys.pypy_version_info.major,
sys.pypy_version_info.minor,
sys.pypy_version_info.micro,
)
if sys.pypy_version_info.releaselevel != "final":
implementation_version = "".join(
[implementation_version, sys.pypy_version_info.releaselevel]
)
else:
implementation_version = "Unknown"
return {
"platform": platform_info,
"implementation": {
"name": implementation,
"version": implementation_version,
},
"cryptography": {"version": getattr(cryptography, "__version__", "")},
"pyjwt": {"version": pyjwt_version},
}
def main():
"""Pretty-print the bug information as JSON."""
print(json.dumps(info(), sort_keys=True, indent=2))
if __name__ == "__main__":
main()
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 1.52 KB | 0644 |
|
| algorithms.py | File | 20.97 KB | 0644 |
|
| api_jwk.py | File | 2.87 KB | 0644 |
|
| api_jws.py | File | 7.65 KB | 0644 |
|
| api_jwt.py | File | 7.13 KB | 0644 |
|
| exceptions.py | File | 965 B | 0644 |
|
| help.py | File | 1.57 KB | 0644 |
|
| jwks_client.py | File | 1.88 KB | 0644 |
|
| py.typed | File | 0 B | 0644 |
|
| utils.py | File | 2.45 KB | 0644 |
|