UCloud authentication for the awesome requests!
How to Install
Just
pip install requests-ucloud
How to Use
Just pass the auth object to requests
Omni API Auth
For common api and ufile authentication
>>> import requests
>>> from ucloudauth import UCloudOmniAuth
>>> session = reqeusts.session()
>>> session.auth = UCloudOmniAuth("public-key", "private-key")
>>> session.get(
... "http://api.ucloud.cn",
... params=dict(Action="SomeAction") # demo of common api
... )
<Response [200]>
>>> session.put(
... "http://bucket.ufile.ucloud.cn/key",
... data="test-data" # demo of ufile api
... )
<Response [200]>
Common UCloud Auth
>>> import requests
>>> from ucloudauth import UCloudAuth
>>> requests.get(
... "https://api.ucloud.cn/",
... params=dict(SomeParams="SomeValue"),
... auth=UCLoudAuth("public-key", "private-key")
... )
<Response [200]>
UFile Object Auth
>>> import requests
>>> from ucloudauth import UFile
>>> session = requests.session()
>>> session.auth = UFileAuth(
... "public-key",
... "private-key",
... expires=None, # for signing in url, expires is unix `timestamp`
... expires_in=None, # for signing in url, expires in `x` seconds
... allow_empty_md5=False # if no content-md5 was provided, UFileAuth will calculate for you
... # set to `True` to disable this function
... )
>>> req = session.put(
... "http://bucket-name.ufile.ucloud.cn/test-key.txt",
... data="test-data"
... )
<Response [200]>
>>> url_auth = UFileAuth(
... "public-key",
... "private-key",
... expires=None, # for signing in url, expires is unix `timestamp`
... expires_in=10, # for signing in url, expires in 10 seconds
... )
>>> req = requests.Request(
... "GET", # http method
... "http://bucket-name.ufile.ucloud.cn/test-key.txt", # url
... auth=url_auth
... )
>>> req.prepare().url
"http://bucket-name.ufile.cloud.cn/test-key.txt?Signature&Other&Params"
UCloud API
View full UCloud API
UFile API
View full UFile API
Metadata
Release files for requests-ucloud 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| requests-ucloud-0.3.1.tar.gz | 9.3 kB | Without provenance | Details |
Release files / requests-ucloud-0.3.1.tar.gz
| Download URL | requests-ucloud-0.3.1.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20b15e850f683174f36f5cde2aed7cdb97b85fffe7210f6bff9a245a33a35b3d
|
|
BLAKE2b-256 checksum How to use checksums |
244ca6862c2f6701bd60286fd3c181034b9ecc2ee85e0abd5fd3478a734b2627
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for requests-ucloud 0.3.1
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.