Skip to main content

帮助你生成百度云 API 的鉴权认证字符串(Authorization header)

Project description

Build Status Coverage Status image image image

baidu-bce-auth

帮助你生成百度云 API 的鉴权认证字符串(Authorization header)

百度云 API 鉴权认证的文档:https://cloud.baidu.com/doc/Reference/s/njwvz1yfu

使用方法,以 requests 为例

from bceauth.auth import make_auth

ak = 'xxx'
sk = 'yyy'
path = 'zzz'
url = 'http://example.com'
params = {}

requests.get(
    url,
    params=params,
    headers={
        'Authorization': make_auth(   # <== 调用 make_auth,得到 Authorization 的内容
            ak=ak,
            sk=sk,
            method='GET',
            path=path,
            params=params,
            headers={
                'Host': 'example.com',
            },
        ),
        'Host': 'example.com',
    }
)

完整的例子,可以参考:tests/test_auth.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baidu_bce_auth-0.0.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file baidu_bce_auth-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: baidu_bce_auth-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for baidu_bce_auth-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 37dc6039bbae12718c76e0851e1faecc51436e98bb4be582c5ecd2b5c9819090
MD5 de86ffd0693d35b02403b939df2d3236
BLAKE2b-256 c39050559c0265bfc40abc32d8675bfb80fbe76446e8d080b710eb04c53f1908

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page