def add_key(gituser, gitpass): """add_key:<githubuser>,<githubpass>. Adds a new key to github. """ run("mkdir -p ~/.ssh") key_file = "id_rsa.git" private_key_file = os.path.join("/tmp/", key_file) public_key_file = "%s.pub" % private_key_file remote_full_key_path = os.path.join("/home", env.user, ".ssh", key_file) ssh.add_ssh_config("github.com", key_file=remote_full_key_path) local("rm -rf %s %s" % (private_key_file, public_key_file)) local("ssh-keygen -t rsa -f %s " % private_key_file) with file(public_key_file, "r") as f: key = f.read() print "====BEGIN PUBLIC KEY=====" print key print "====END PUBLIC KEY=======" data = {'title': "key for: %s" % env.host, 'key': key} client = WebClient("https://api.github.com", verbose=True) client.authenticate(username=gituser, password=gitpass) put(private_key_file, "~/.ssh") run("chmod 600 %s" % remote_full_key_path) client.post("/user/keys", data)
def __init__(self): self.app = WinClient self.client = WebClient(8081, pi_address) self.client.set_lock_handler(self.lock_handler) self.client.set_unlock_handler(self.unlock_handler) self.client.start() print('Hello World!')
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" dds = DirectionSolver() wcl = WebClient(dds) wcl.run("ws://codenjoy.com:80/codenjoy-contest/ws", 'au')
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" dds = DirectionSolver() wcl = WebClient(dds) wcl.run("ws://tetrisj.jvmhost.net:12270/codenjoy-contest/ws", 'au')
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # substitute following link with the one you've copied in your browser after registration url = "https://dojorena.io/codenjoy-contest/board/player/8aq9izxu40h7blnrd3l9?code=6712803793075447834&gameName=bomberman" direction_solver = DirectionSolver() wcl = WebClient(url=get_url_for_ws(url), solver=direction_solver) wcl.run_forever()
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # paste here board page url from browser after registration # url = f"http://127.0.0.1:8080/codenjoy-contest/board/player/0?code=000000000000" url = f"https://practice.epam-botchallenge.com/codenjoy-contest/board/player/ba0hceicbze6l2mqkmrb?code=5495296893386541378&game=battlecity" direction_solver = DirectionSolver() wcl = WebClient(url=get_url_for_ws(url), solver=direction_solver) wcl.run_forever()
def main(): dds = DirectionSolver() wcl = WebClient(dds) server = 'ws://localhost:8080/codenjoy-contest/ws' user = '******' code = '1351323692637632922' wcl.run(server, user, code)
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # substitute following link with the one # you've copied in your browser after registration url = environ["URL"] direction_solver = DirectionSolver() wcl = WebClient(url=get_url_for_ws(url), solver=direction_solver) wcl.run_forever()
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # substitute following link with the one you've copied in your browser after registration #url = "http://localhost:8080/codenjoy-contest/board/player/0?code=000000000000" url = "https://epam-botchallenge.com/codenjoy-contest/board/player/v50trdhg80hxed60q7xc?code=331017081544738029" direction_solver = DirectionSolver() wcl = WebClient(url=get_url_for_ws(url), solver=direction_solver) wcl.run_forever()
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # substitute following link with the one you've copied in your browser after registration url = "http://3.133.109.198:8080//codenjoy-contest/board/player/g2kzb99qhnjs217fkcyy?code=3689161262388400247&gameName=bomberman" direction_solver = DirectionSolver() print(get_url_for_ws(url)) wcl = WebClient(url=get_url_for_ws(url), solver=direction_solver) wcl.run_forever()
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" dds = DirectionSolver() wcl = WebClient(dds) user = '******' code = '0000000000000000000' wcl.run("ws://host:port/codenjoy-contest/ws", user, code)
def __init__(self, host, port=None, path=None): if not port and not path: matches = re.search("http://(\w+)(:\d+)?(.+)", host) host = matches.group(1) port = int(matches.group(2)[1:]) path = matches.group(3) self.host = host self.path = path self.port = port self.webclient = WebClient(host=host, port=port) self.registered_namespaces = {}
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # you can get this URL after registration on the server with your email url = "http://*****:*****@:%._\+~#=\.]+)/codenjoy-contest/board/player/([a-z0-9]+)\?code=([0-9]+)" ) rematch = repattern.match(url) serverandport = rematch.group(1) username = rematch.group(2) usercode = rematch.group(3) dds = DirectionSolver() wcl = WebClient(dds) wcl.run(serverandport, username, usercode)
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" # substitute following link with the one you've copied in your browser after registration url = "http://codenjoy.com:80/codenjoy-contest/board/player/3edq63tw0bq4w4iem7nb?code=12345678901234567890" repattern = re.compile( "^https?://([-a-zA-Z0-9@:%._\+~#=\.]+)/codenjoy-contest/board/player/([a-z0-9]+)\?code=([0-9]+)" ) rematch = repattern.match(url) serverandport = rematch.group(1) username = rematch.group(2) usercode = rematch.group(3) dds = DirectionSolver() wcl = WebClient(dds) wcl.run(serverandport, username, usercode)
def main(): assert version_info[0] == 3, "You should run me with Python 3.x" config_init() if QT_BOARD_SHOW: qt_create_board() # substitute following link with the one you've copied in your browser after registration direction_solver = DirectionSolver() if DEBUG: board_string = "".join("".join(b) for b in BOARDDEBUG) direction_solver.get(board_string) else: url = REMOTE_URL wcl = WebClient(url=get_url_for_ws(url), solver=direction_solver) wcl.run_forever()
print(usage(sys.argv[0])) exit(0) args = sys.argv if args[1] == "fake": print("--> faking download") if not len(args) == 3: print(" -> can't fake without a value") exit() components = [ [Label("some.file"), Remaining(), Speed(), Bar(), Percentage()], ] for c in components: run_download(c, int(args[2])) exit() url = sys.argv[1] client = WebClient(ProgressBarFactory()) try: client.get(url) except KeyboardInterrupt: print("\nUser canceled download")
def __enrich_data(self, latitude, longitude): webclient = WebClient() address = webclient.get_address_by_latlong(latitude, longitude) return address