Skip to main content

PYJWT3

介绍

作者:钟阳
pyjwt3 是一个用于生成和验证JWT令牌的Python模块。

安装

你可以通过以下命令安装 pyjwt3:

pip install pyjwt3

代码例程

创建JWT签名

import pyjwt3 as jwt
token = jwt.creatr_sign(aud='jwt.system',sub='username',iss='system',key='000000')
print(token)

验证JWT签名,并返回Payload

import pyjwt3 as jwt
#token组成:Bearer + ' ' + jwt.creatr_sign()的返回值
token = 'Bearer eyJhbGciOiAiSFMyNTYiLCAidHlwZSI6ICJKV1QifQ==.eyJhdWQiOiAiY3JtLnl1bmRhb3d1LmNuIiwgImV4cCI6IDE3NDIxNjcxNDksICJpYXQiOiAxNzQyMDgwNzQ5LCAiaXNzIjogInN5c3RlbSIsICJ1aWQiOiAxLCAic3ViIjogImFkbWluIiwgIm5iZiI6IDE3NDIwODA3NDl9.5YEtizmQHCmWBfFbhPK8bfM7binlThY_uKv--0wU_UY'
#传入的key一定要和签名时传入的key一样,并且不能泄露
payload = verify_sign(token=token, key='000000')
if payload:
    print('验证通过')
    print(f'Payload:{payload}')

Metadata

Release files for pyjwt3 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyjwt3 1.0.0
File Size Uploaded Provenance
pyjwt3-1.0.0.tar.gz 2.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyjwt3 1.0.0
File Interpreter ABI Platform
pyjwt3-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / pyjwt3-1.0.0.tar.gz

Download URL pyjwt3-1.0.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c7491e92ba77224cb0d8adbdf76465354007f4f0209fed27b70df1c15e6702cd
BLAKE2b-256 checksum
How to use checksums
6455ed0fa3d8e9fd42d2042ff23eccd266352f89103648f0bc3d88cdac714dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / pyjwt3-1.0.0-py3-none-any.whl

Download URL pyjwt3-1.0.0-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d34621d84972ef2fd1683703a57b2b147bdd67816906b218f3a66041aa748b01
BLAKE2b-256 checksum
How to use checksums
5a69ced807a5452363fed8cace3a7b10163ac5161c6ee88fa03c7d64987ef5c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Security for pyjwt3 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page