Rackspace Identity Authentication Extension¶
This authentication extension enables simple authentication to Rackspace Cloud endpoints.
Sample Usage¶
import requests
from requests_cloud_auth import rackspace
auth = rackspace.RackspacePasswordAuth(
username='my_user',
password='my_pass'
)
# Pre-auth as we need our project_id to list our cloud servers
auth.authenticate()
url = 'https://ord.servers.api.rackspacecloud.com/v2/{0}/servers'.format(auth.project_id)
resp = requests.get(url, auth=auth)
Extension API Documentation¶
-
class
requests_cloud_auth.rackspace.
RackspacePasswordAuth
(username, password, endpoint=None, region='US')¶ - Authentication extension for Requests that supports Rackspace
- password authentication.
Parameters: - username – Valid Rackspace Cloud username
- password – Valid Rackspace Cloud password
- endpoint – (optional) URI to override authentication endpoint
- region – (optional) Specify the Rackspace Cloud region. Supported values: US, UK
Returns: Instance of RackspacePasswordAuth
-
authenticate
()¶ Gets authentication credentials
Attempts to use cached credentials before making a remote call. Automatically called by requests when needed, but can be manually called when needed.
-
class
requests_cloud_auth.rackspace.
RackspaceApiKeyAuth
(username, api_key, endpoint=None, region='US')¶ - Authentication extension for Requests that supports Rackspace
- API key authentication.
Parameters: - username – Valid Rackspace Cloud username
- api_key – Valid Rackspace Cloud API key
- endpoint – (optional) URI to override authentication endpoint
- region – (optional) Specify the Rackspace Cloud region. Supported values: US, UK
Returns: Instance of RackspaceApiKeyAuth
-
authenticate
()¶ Gets authentication credentials
Attempts to use cached credentials before making a remote call. Automatically called by requests when needed, but can be manually called when needed.