def __init__(self, username, api_key, authurl=default_authurl):
     self.authurl = authurl
     self.headers = {
             'x-auth-user': username,
             'x-auth-key': api_key,
             'User-Agent': user_agent}
     self.host, self.port, self.uri, self.is_ssl = parse_url(self.authurl)
     self.conn_class = (self.is_ssl and HTTPSConnection) or HTTPConnection
示例#2
0
 def _authenticate(self):
     """
     Authenticate and setup this instance with the values returned.
     """
     (self.url, self.token) = self.auth.authenticate()
     self.connection_args = parse_url(self.url)
     self.conn_class = (self.connection_args[3] and HTTPSConnection) or HTTPConnection
     self.http_connect()