machine.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:two1-python 作者: 21dotco 项目源码 文件源码
def connect_market(self, client, market):
        try:
            zt_device_address = json.loads(self.docker_ssh("sudo ./zerotier-cli info -j",
                                                           stderr=subprocess.DEVNULL).decode())["address"]
            response = client.join(market, zt_device_address)
            if response.ok:
                network_id = response.json().get("networkid")
                self.docker_ssh("sudo ./zerotier-cli join %s" % network_id, stderr=subprocess.DEVNULL)
                if self.wait_for_zt_confirmation():
                    pass
        except exceptions.ServerRequestError as e:
            if e.status_code == 400:
                logger.info(uxstring.UxString.invalid_network)
            else:
                raise e
        except subprocess.CalledProcessError as e:
            logger.info(str(e))
        time.sleep(10)  # wait for interface to come up
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号