def getresponse(self): r = LibcloudHTTPSConnection.getresponse(self) if self.log is not None: r, rv = self._log_response(r) self.log.write(rv + "\n") self.log.flush() return r
def request_consumer_key(self, user_id): action = self.request_path + '/auth/credential' data = json.dumps({ 'accessRules': DEFAULT_ACCESS_RULES, 'redirection': 'http://runabove.com', }) headers = { 'Content-Type': 'application/json', 'X-Ra-Application': user_id, } httpcon = LibcloudHTTPSConnection(self.host) httpcon.request(method='POST', url=action, body=data, headers=headers) response = httpcon.getresponse() if response.status == httplib.UNAUTHORIZED: raise InvalidCredsError() body = response.read() json_response = json.loads(body) httpcon.close() return json_response
def request_consumer_key(self, user_id): action = self.request_path + '/auth/credential' data = json.dumps({ 'accessRules': DEFAULT_ACCESS_RULES, 'redirection': 'http://runabove.com', }) headers = { 'Content-Type': 'application/json', 'X-Ra-Application': user_id, } httpcon = LibcloudHTTPSConnection(self.host) httpcon.request(method='POST', url=action, body=data, headers=headers) response = httpcon.getresponse() if response.status == httplib.UNAUTHORIZED: raise InvalidCredsError() body = response.read() json_response = json.loads(body) httpcon.close() return json_response