获得当前账号的应用列表

        列出所属应用为当前请求方的应用列表。

        Returns:
            返回一个tuple对象，其格式为(<result>, <ResponseInfo>)
            - result          成功返回应用列表，失败返回None
            - ResponseInfo    请求的Response信息
324476
def list_apps(self):
        

        url = '{0}/v3/apps'.format(self.host)
        return http._get_with_qiniu_mac(url, None, self.auth)
515312
def get_response(self, results):
        
        if results is None:
            return None
        for result in itertools.chain.from_iterable(results):
            if isinstance(result, BaseResponse):
                return result
814967
def parse_response(response):
    
    if isinstance(response, tuple):
        if len(response) > 2:
            return response[0], response[1], response[2]
        elif len(response) > 1:
            return response[0], response[1], {}
    try:
        return response.data, response.status_code, response.headers
    except AttributeError:
        return response, 200, {}
35115
def get_one(self, qry, tpl):
        '''  '''
        self.cur.execute(qry + ' LIMIT 1', tpl)
        result = self.cur.fetchone()
        # unpack tuple if it has only
        # one element
        # TODO unpack results
        if type(result) is tuple and len(result) == 1:
            result = result[0]
        return result
622732
def response_as_series(self):
        
        assert len(self.symbols) == 1, 'expected single request'
        if self.response_type == 'frame':
            return self.response.ix[self.symbols[0]]
        else:
            return pandas.Series(self.response[self.symbols])
262180
def get_question_results(self, number: str, username: str) -> dict:
        
        try:
            # 操作所需資訊
            params = {
                'questionID': number,
                'studentID': username
            }
            # 取得資料
            response = self.__session.get(
                self.__url + '/CheckResult.jsp', params=params, timeout=0.5, verify=False)
            soup = BeautifulSoup(response.text, 'html.parser')
            # 整理指定用戶之測試結果
            results = {}
            for tag in soup.find_all('tr'):
                # 取得測試結果
                result = tag.find_all('td')
                # 跳過標題列
                if result[0].get_text().strip() != '測試編號':
                    index = result[0].get_text().strip()
                    status = result[1].get_text().strip()
                    results[index] = status
            # 回傳結果
            return results

        except requests.exceptions.Timeout:
            return {'Timeout': 'Timeout'}
314036
def requestTimingInfo(self):
        
        try:
            return tuple(item.split('=')[1] for item in self.http_response.header.get('CMS-Server-Time').split())
        except AttributeError:
            return None, None
807386
def parse_imethodresponse(self, tup_tree):
        

        self.check_node(tup_tree, 'IMETHODRESPONSE', ('NAME',))

        return (name(tup_tree), attrs(tup_tree),
                self.list_of_various(tup_tree,
                                     ('ERROR', 'IRETURNVALUE', 'PARAMVALUE')))
704839
def _ResponseToClientsFullInfo(self, response):
    """"""
    c_full_info = None
    prev_cid = None
    for row in response:
      (cid, fs, crt, ping, clk, ip, foreman, first, last_client_ts,
       last_crash_ts, last_startup_ts, client_obj, client_startup_obj,
       last_startup_obj, label_owner, label_name) = row

      if cid != prev_cid:
        if c_full_info:
          yield db_utils.IntToClientID(prev_cid), c_full_info

        metadata = rdf_objects.ClientMetadata(
            certificate=crt,
            fleetspeak_enabled=fs,
            first_seen=mysql_utils.TimestampToRDFDatetime(first),
            ping=mysql_utils.TimestampToRDFDatetime(ping),
            clock=mysql_utils.TimestampToRDFDatetime(clk),
            ip=mysql_utils.StringToRDFProto(rdf_client_network.NetworkAddress,
                                            ip),
            last_foreman_time=mysql_utils.TimestampToRDFDatetime(foreman),
            startup_info_timestamp=mysql_utils.TimestampToRDFDatetime(
                last_startup_ts),
            last_crash_timestamp=mysql_utils.TimestampToRDFDatetime(
                last_crash_ts))

        if client_obj is not None:
          l_snapshot = rdf_objects.ClientSnapshot.FromSerializedString(
              client_obj)
          l_snapshot.timestamp = mysql_utils.TimestampToRDFDatetime(
              last_client_ts)
          l_snapshot.startup_info = rdf_client.StartupInfo.FromSerializedString(
              client_startup_obj)
          l_snapshot.startup_info.timestamp = l_snapshot.timestamp
        else:
          l_snapshot = rdf_objects.ClientSnapshot(
              client_id=db_utils.IntToClientID(cid))

        if last_startup_obj is not None:
          startup_info = rdf_client.StartupInfo.FromSerializedString(
              last_startup_obj)
          startup_info.timestamp = mysql_utils.TimestampToRDFDatetime(
              last_startup_ts)
        else:
          startup_info = None

        prev_cid = cid
        c_full_info = rdf_objects.ClientFullInfo(
            metadata=metadata,
            labels=[],
            last_snapshot=l_snapshot,
            last_startup_info=startup_info)

      if label_owner and label_name:
        c_full_info.labels.append(
            rdf_objects.ClientLabel(name=label_name, owner=label_owner))

    if c_full_info:
      yield db_utils.IntToClientID(prev_cid), c_full_info
185738
def _getResponse(self):
        
        resp_dict= dict()
        resp_str = self._conn.read_until("\r\n\r\n", connTimeout)
        for line in resp_str.split("\r\n"):
            mobj = re.match('(\w+):\s*(\S.*)$', line);
            if mobj:
                resp_dict[mobj.group(1)] = mobj.group(2)
            else:
                mobj = re.match('(.*)--END COMMAND--\s*$', line, flags=re.DOTALL)
                if mobj:
                    resp_dict['command_response'] = mobj.group(1)
        return resp_dict
815809
def _get_response(self, url, **params):
        
        data = urlencode(params)
        url = "%s?%s" % (url, data)
        headers = {'User-Agent': self.get_random_agent()}
        request = Request(url, headers=headers, method='GET')

        def open_request(request, attempts, err=None):
            if attempts > self.request_attempts:
                raise
            attempts += 1
            try:
                with urlopen(request, timeout=self.timeout) as response:
                    return response.read()
            except HTTPError as err:
                if err.getcode() < 500:
                    raise
                print("HTTPError occurred while trying to request the url "
                      "%s. %s. Trying again in %s seconds..." % (url, err,
                                                self.seconds_between_attempts))
                time.sleep(self.seconds_between_attempts)
                return open_request(request, attempts, err)

        attempts = 0
        self.last_response = open_request(request, attempts)
        return self.last_response
10379
def get_request_token(self):
        
        
        if self._request_token is None:
            self._request_token = self._get_request_token()
        return self._request_token
803263
def from_tuple(self, t):
        
        if len(t) > 1:
            self.id = t[0]
            self.sitting = t[1]
        else:
            self.sitting = t[0]
            self.id = None
        return self
86310
async def parse_result(response, response_type=None, *, encoding="utf-8"):
    
    if response_type is None:
        ct = response.headers.get("content-type")
        if ct is None:
            cl = response.headers.get("content-length")
            if cl is None or cl == "0":
                return ""
            raise TypeError(
                "Cannot auto-detect response type "
                "due to missing Content-Type header."
            )
        main_type, sub_type, extras = parse_content_type(ct)
        if sub_type == "json":
            response_type = "json"
        elif sub_type == "x-tar":
            response_type = "tar"
        elif (main_type, sub_type) == ("text", "plain"):
            response_type = "text"
            encoding = extras.get("charset", encoding)
        else:
            raise TypeError("Unrecognized response type: {ct}".format(ct=ct))
    if "tar" == response_type:
        what = await response.read()
        return tarfile.open(mode="r", fileobj=BytesIO(what))
    if "json" == response_type:
        data = await response.json(encoding=encoding)
    elif "text" == response_type:
        data = await response.text(encoding=encoding)
    else:
        data = await response.read()
    return data
29300
def tuple_len(self):
        
        try:
            return self._tuple_len
        except AttributeError:
            raise NotImplementedError("Class {} does not implement attribute 'tuple_len'.".format(self.__class__.__name__))
1307043
def get_response_example(cls, operation, response):
        
        path = "#/paths/'{}'/{}/responses/{}".format(
            operation.path, operation.method, response.name)
        kwargs = dict(paths=[path])

        if response.type in PRIMITIVE_TYPES:
            result = cls.get_example_value_for_primitive_type(
                response.type, response.properties, response.type_format, **kwargs)
        else:
            schema = SchemaObjects.get(response.type)
            result = cls.get_example_by_schema(schema, **kwargs)

        return result
733868
def get(self, *index):
        
        assert self.wrapFunction is not None
        if len(index) == 1 and isinstance(index[0], (tuple, list)):
            index = index[0]
        if len(index) == 0:
            return self.wrapFunction(self._impl.get())
        else:
            return self.wrapFunction(self._impl.get(Tuple(index)._impl))