Twisted代理实现,用于对Keystone进行身份验证,并使用Keystone身份验证凭据对请求的URL进行身份验证。
项目描述
## Twisted Python Keystone Agent
[](http://travis-ci.org/racker/python-twisted-keystone-agent)
## 使用示例
```python
从twisted.internet导入reactor
从twisted.web.client导入Agent
从txKeystone导入KeystoneAgent
agent = Agent(reactor)
RACKSPACE_USERNAME = '' # 请在此处填写您的用户名
RACKSPACE_APIKEY = '' # 请在此处填写您的API密钥
AUTH_URL = 'https://identity.api.rackspacecloud.com/v2.0/tokens'
keystone_agent = KeystoneAgent(agent,
AUTH_URL,
(RACKSPACE_USERNAME, RACKSPACE_APIKEY))
```
现在可以使用`keystone_agent`像[twisted.web.client.Agent](http://twistedmatrix.com/documents/current/web/howto/client.html)一样
(请参阅"[接收响应](http://twistedmatrix.com/documents/current/web/howto/client.html#auto4)")
来向Rackspace API发送请求,并且`X-Tenant-Id`和`X-Auth-Token`头部将自动设置。
[](http://travis-ci.org/racker/python-twisted-keystone-agent)
## 使用示例
```python
从twisted.internet导入reactor
从twisted.web.client导入Agent
从txKeystone导入KeystoneAgent
agent = Agent(reactor)
RACKSPACE_USERNAME = '' # 请在此处填写您的用户名
RACKSPACE_APIKEY = '' # 请在此处填写您的API密钥
AUTH_URL = 'https://identity.api.rackspacecloud.com/v2.0/tokens'
keystone_agent = KeystoneAgent(agent,
AUTH_URL,
(RACKSPACE_USERNAME, RACKSPACE_APIKEY))
```
现在可以使用`keystone_agent`像[twisted.web.client.Agent](http://twistedmatrix.com/documents/current/web/howto/client.html)一样
(请参阅"[接收响应](http://twistedmatrix.com/documents/current/web/howto/client.html#auto4)")
来向Rackspace API发送请求,并且`X-Tenant-Id`和`X-Auth-Token`头部将自动设置。
项目详情
关闭
txKeystone-0.1.3.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f0395d59321edce373fd3e0b7ac4742b63ae2a71d6a752c4d44dc639a431c5f5 |
|
MD5 | 544546d11ebaf4c61665ec1e67ae6dac |
|
BLAKE2b-256 | 49d330047aa16e6bf94fcc5b80032552d43d1e59c82bbc6ed1f320965753a71a |