Python client.Client() Examples
The following are 10
code examples of client.Client().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
client
, or try the search function
.
Example #1
Source File: Stateless_module.py From XFLTReaT with MIT License | 6 votes |
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
Example #2
Source File: Stateful_module.py From XFLTReaT with MIT License | 5 votes |
def get_client_encryption(self, additional_data): return self.encryption # set up the Client object for a new client
Example #3
Source File: server.py From avacity-2.0 with MIT License | 5 votes |
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()
Example #4
Source File: location.py From avacity-2.0 with MIT License | 5 votes |
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
Example #5
Source File: bots.py From fbctf-2019-challenges with MIT License | 5 votes |
def __init__(self, server, handler): self._client = Client(server) self._handler = handler
Example #6
Source File: bots.py From fbctf-2019-challenges with MIT License | 5 votes |
def __init__(self, server, handler): self._client = Client(server) self._handler = handler
Example #7
Source File: binja_frontend.py From revsync with MIT License | 5 votes |
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()
Example #8
Source File: main.py From leaf with BSD 2-Clause "Simplified" License | 5 votes |
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
Example #9
Source File: main.py From leaf with BSD 2-Clause "Simplified" License | 5 votes |
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
Example #10
Source File: nova.py From script.elementum.nova with Do What The F*ck You Want To Public License | 4 votes |
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