Skip to main content

authentication for ucloud service

Project description

UCloud authentication for the awesome requests!

https://travis-ci.org/SkyLothar/requests-ucloud.svg?branch=master https://coveralls.io/repos/SkyLothar/requests-ucloud/badge.png https://requires.io/github/SkyLothar/requests-ucloud/requirements.svg?branch=master Supported Python versions License

How to Install

Just

pip install requests-ucloud

How to Use

Just pass the auth object to requests

Common UCloud Auth

>>> import requests
>>> from ucloudauth import UCloudAuth
>>> req = requests.get(
...     "https://api.ucloud.cn/",
...     params=dict(SomeParams="SomeValue"),
...     auth=UCLoudAuth("public-key", "private-key")
... )
<Response [200]>

Or set the auth attribute to the session object

>>> import requests
>>> from ucloudauth import UCloudAuth
>>> session = requests.session()
>>> session.auth = UCloudAuth("public-key", "private-key")
>>> req = session.get(
...     "https://api.ucloud.cn/",
...     params=dict(SomeParams="SomeValue")
... )
<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]>

UCloud API

View full UCloud API

UFile API

View full UFile API

Project details


Download files

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

Source Distribution

requests-ucloud-0.1.3.tar.gz (8.9 kB view hashes)

Uploaded Source

Supported by

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