client.py 文件源码

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

项目:telnet-iot-honeypot 作者: Phype 项目源码 文件源码
def put_sample_info(self, f, retry=True):
        try:
            sha256 = f["sha256"]
            r = requests.put(self.url + "/sample/" + sha256, auth=self.auth, json=f, timeout=20.0)
        except requests.exceptions.RequestException:
            dbg("Cannot connect to backend")
            return

        if r.status_code == 200:
            return r.json()
        elif retry:
            msg = r.raw.read()
            dbg("Backend upload failed, retrying (" + str(msg) + ")")
            return self.put_sample_info(f, False)
        else:
            msg = r.raw.read()
            raise IOError(msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号