當前位置: 首頁>>代碼示例>>Python>>正文


Python client.Client方法代碼示例

本文整理匯總了Python中client.Client方法的典型用法代碼示例。如果您正苦於以下問題:Python client.Client方法的具體用法?Python client.Client怎麽用?Python client.Client使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在client的用法示例。


在下文中一共展示了client.Client方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_client_encryption

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def get_client_encryption(self, additional_data):
		if self.serverorclient:
			# server mode
			# select client, based on public details
			c = self.lookup_client_pub(additional_data)
			if c:
				# if found, return object's encryption details
				return c.get_encryption()
			else:
				# this must be a new client, creating new encryption object
				e = encryption.Encryption_details()
				e.set_module(self.encryption_module)
				return e
		else:
			# client mode
			return self.encryption

	# set up the Client object for a new client 
開發者ID:earthquake,項目名稱:XFLTReaT,代碼行數:20,代碼來源:Stateless_module.py

示例2: get_client_encryption

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def get_client_encryption(self, additional_data):
		return self.encryption

	# set up the Client object for a new client 
開發者ID:earthquake,項目名稱:XFLTReaT,代碼行數:6,代碼來源:Stateful_module.py

示例3: listen

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def listen(self):
        self.sock.listen(5)
        logging.info("Server is ready to accept connections")
        thread = threading.Thread(target=self._background)
        thread.daemon = True
        thread.start()
        while True:
            client, address = self.sock.accept()
            thread = threading.Thread(target=Client(self).handle,
                                      args=(client, address))
            thread.daemon = True
            thread.start() 
開發者ID:AvaCity,項目名稱:avacity-2.0,代碼行數:14,代碼來源:server.py

示例4: gen_plr

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def gen_plr(client, server):
    if isinstance(client, Client):
        uid = client.uid
    else:
        uid = client
    apprnc = server.get_appearance(uid)
    if not apprnc:
        return None
    user_data = server.get_user_data(uid)
    clths = server.get_clothes(uid, type_=2)
    plr = {"uid": uid, "apprnc": apprnc, "clths": clths,
           "mbm": {"ac": None, "sk": "blackMobileSkin"},
           "usrinf": {"rl": user_data["role"]}}
    if isinstance(client, Client):
        plr["locinfo"] = {"st": client.state, "s": "127.0.0.1",
                          "at": client.action_tag, "d": client.dimension,
                          "x": client.position[0], "y": client.position[1],
                          "shlc": True, "pl": "", "l": client.room}
    plr["ci"] = {"exp": user_data["exp"], "crt": user_data["crt"],
                 "hrt": user_data["hrt"], "fexp": 0, "gdc": 0, "lgt": 0,
                 "vip": True, "vexp": 1965298000, "vsexp": 1965298000,
                 "vsact": True, "vret": 0, "vfgc": 0, "ceid": 0, "cmid": 0,
                 "dr": True, "spp": 0, "tts": None, "eml": None, "ys": 0,
                 "ysct": 0, "fak": None, "shcr": True, "gtrfrd": 0,
                 "strfrd": 0, "rtrtm": 0, "kyktid": None, "actrt": 0,
                 "compid": 0, "actrp": 0, "actrd": 0, "shousd": False,
                 "rpt": 0, "as": None, "lvt": user_data["lvt"],
                 "lrnt": 0, "lwts": 0, "skid": None, "skrt": 0, "bcld": 0,
                 "trid": user_data["trid"], "trcd": 0, "sbid": None,
                 "sbrt": 0, "plcmt": {}, "pamns": {"amn": []}, "crst": 0}
    plr["pf"] = {"pf": {"jntr": {"tp": "jntr", "l": 20, "pgs": 0},
                        "phtghr": {"tp": "phtghr", "l": 20, "pgs": 0},
                        "grdnr": {"tp": "grdnr", "l": 20, "pgs": 0},
                        "vsgst": {"tp": "vsgst", "l": 20, "pgs": 0}}}
    return plr 
開發者ID:AvaCity,項目名稱:avacity-2.0,代碼行數:37,代碼來源:location.py

示例5: __init__

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def __init__(self, server, handler):
        self._client = Client(server)
        self._handler = handler 
開發者ID:fbsamples,項目名稱:fbctf-2019-challenges,代碼行數:5,代碼來源:bots.py

示例6: revsync_load

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def revsync_load(bv):
    global client

    # lets ensure auto-analysis is finished by forcing another analysis
    t0 = threading.Thread(target=do_analysis_and_wait, args=(bv,))
    t0.start()
    t0.join()

    try:
        client
    except:
        client = Client(**config)
    state = bv.session_data.get('revsync')
    if state:
        # close out the previous session
        client.leave(state.fhash)
        state.close()

    state = bv.session_data['revsync'] = State(bv)
    log_info('revsync: connecting with %s' % state.fhash)
    client.join(state.fhash, revsync_callback(bv))
    log_info('revsync: connected!')
    t1 = threading.Thread(target=watch_cur_func, args=(bv,))
    t2 = threading.Thread(target=watch_syms, args=(bv,SymbolType.DataSymbol))
    t3 = threading.Thread(target=watch_syms, args=(bv,SymbolType.FunctionSymbol))
    t4 = threading.Thread(target=watch_structs, args=(bv,))
    t1.daemon = True
    t2.daemon = True
    t3.daemon = True
    t4.daemon = True
    t1.start()
    t2.start()
    t3.start()
    t4.start() 
開發者ID:lunixbochs,項目名稱:revsync,代碼行數:36,代碼來源:binja_frontend.py

示例7: create_clients

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def create_clients(users, groups, train_data, test_data, model):
    if len(groups) == 0:
        groups = [[] for _ in users]
    clients = [Client(u, g, train_data[u], test_data[u], model) for u, g in zip(users, groups)]
    return clients 
開發者ID:TalwalkarLab,項目名稱:leaf,代碼行數:7,代碼來源:main.py

示例8: setup_clients

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def setup_clients(dataset, model=None, use_val_set=False):
    """Instantiates clients based on given train and test data directories.

    Return:
        all_clients: list of Client objects.
    """
    eval_set = 'test' if not use_val_set else 'val'
    train_data_dir = os.path.join('..', 'data', dataset, 'data', 'train')
    test_data_dir = os.path.join('..', 'data', dataset, 'data', eval_set)

    users, groups, train_data, test_data = read_data(train_data_dir, test_data_dir)

    clients = create_clients(users, groups, train_data, test_data, model)

    return clients 
開發者ID:TalwalkarLab,項目名稱:leaf,代碼行數:17,代碼來源:main.py

示例9: extract_from_page

# 需要導入模塊: import client [as 別名]
# 或者: from client import Client [as 別名]
def extract_from_page(provider, content):
    """ Sub-page extraction method

    Args:
        provider (str): Provider ID
        content  (str): Page content from Client instance

    Returns:
        str: Torrent or magnet link extracted from sub-page
    """
    definition = definitions[provider]
    definition = get_alias(definition, get_setting("%s_alias" % provider))

    if provider == "kinozal":
        matches = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', content)
        if matches:
            result = matches[0]
            log.debug('[%s] Matched magnet link: %s' % (provider, repr(result)))
            return result

        matches = re.findall(r'\: ([A-Fa-f0-9]{40})', content)  # kinozal
        if matches:
            result = "magnet:?xt=urn:btih:" + matches[0] + "&tr=http%3A%2F%2Ftr0.torrent4me.com%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Ftr0.torrent4me.com%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Ftr0.tor4me.info%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Ftr0.tor2me.info%2Fann%3Fuk%3Dstl41hKc1E&tr=http%3A%2F%2Fretracker.local%2Fannounce"
            log.debug('[%s] Make magnet from info_hash: %s' % (provider, repr(result)))
            return result

    matches = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', content)
    if matches:
        result = matches[0]
        log.debug('[%s] Matched magnet link: %s' % (provider, repr(result)))
        return result

    matches = re.findall('http(.*?).torrent["\']', content)
    if matches:
        result = 'http' + matches[0] + '.torrent'
        log.debug('[%s] Matched torrent link: %s' % (provider, repr(result)))
        return result

    matches = re.findall('"(/download/[A-Za-z0-9]+)"', content)
    if matches:
        result = definition['root_url'] + matches[0]
        log.debug('[%s] Matched download link: %s' % (provider, repr(result)))
        return result
    return None 
開發者ID:Nemiroff,項目名稱:script.elementum.nova,代碼行數:46,代碼來源:nova.py


注:本文中的client.Client方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。