chrome_crawler.py 文件源码

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

项目:chrome-crawler 作者: lqf96 项目源码 文件源码
def _msg_polling(self):
        """ Front-end message polling route. """
        # Set content type
        res.set_header(b"content-type", b"text/event-stream")
        # Send response header
        yield "retry: 2000\n\n"
        # Polling loop
        while True:
            # Check message sending queue
            while self._msg_queue:
                current_msg = self._msg_queue.popleft()
                yield "data: "+b64encode(quote(json.dumps(current_msg)))+"\n\n"
            sleep(0)
    # Server side data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号