def __init__(self, username, api_key, authurl=us_authurl, timeout=15, useragent=user_agent): self.authurl = authurl self.headers = dict() self.headers['x-auth-user'] = username self.headers['x-auth-key'] = api_key self.headers['User-Agent'] = useragent self.timeout = timeout (self.host, self.port, self.uri, self.is_ssl) = parse_url(self.authurl) self.conn_class = get_conn_class(self.is_ssl)
def _authenticate(self): """ Authenticate and setup this instance with the values returned. """ (url, self.cdn_url, self.token) = self.auth.authenticate() url = self._set_storage_url(url) self.connection_args = parse_url(url) self.conn_class = get_conn_class(self.connection_args[3]) self.http_connect() if self.cdn_url: self.cdn_connect()