authentication for aliyun service
Project description
Aliyun authentication for the awesome requests!
[x] OSS (api-version: 2014-08-28)
[x] ECS (api-version: 2014-05-26)
[x] RDS (api-version: 2014-08-15)
[x] SLB (api-version: 2014-05-15)
How to Install
Just
pip install requests-aliyun
How to Use
Just pass the auth object to requests
>>> import requests
>>> from aliyunauth import OssAuth
>>> req = requests.get(
... "http://example.com/path/to/file",
... auth=OssAuth("bucket-name", "access-key", "secret-key")
... )
<Response [200]>
Or set the auth attribute to the session object
>>> import requests
>>> from aliyunauth import OssAuth
>>> session = requests.session()
>>> session.auth = OssAuth("bucket-name", "access-key", "secret-key")
>>> req = session.get("http://example.com/path/to/file")
<Response [200]>
Play with OSS
Full api document avaiable at: OSS API
>>> import requests
>>> from aliyunauth import OssAuth
>>> req = requests.get(
... "http://bucket-name.oss-url.com/path/to/file",
... auth=OssAuth("bucket-name", "access-key", "secret-key")
... )
<Response [200]>
Play with ECS
Full api document avaiable at: ECS API
>>> import requests
>>> from aliyunauth import EcsAuth
>>> req = requests.get(
... "https://ecs.aliyuncs.com",
... params=dict(Action="DescribeInstanceTypes"),
... auth=EcsAuth("access-key", "secret-key")
... )
<Response [200]>
Play with RDS
Full api document avaiable at: RDS API
>>> import requests
>>> from aliyunauth import RdsAuth
>>> req = requests.get(
... "https://rds.aliyuncs.com",
... params=dict(Action="DescribeDBInstances", RegionId="cn-hangzhou"),
... auth=RdsAuth("access-key", "secret-key")
... )
<Response [200]>
Play with SLB
Full api document avaiable at: SLB API
>>> import requests
>>> from aliyunauth import SlbAuth
>>> req = requests.get(
... "https://slb.aliyuncs.com",
... params=dict(Action="DescribeRegions"),
... auth=SlbAuth("access-key", "secret-key")
... )
<Response [200]>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
requests-aliyun-0.2.2.tar.gz
(11.9 kB
view hashes)