ALTOInterface.py 文件源码

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

项目:PyPPSPP 作者: justas- 项目源码 文件源码
def do_alto_post(self, endpoint, data, callback):
        """ALTO post to the given endpoint with given data"""

        # Make HTTP POST to ALTO
        url = self._alto_url + endpoint
        try:
            alto_resp_future = self._loop.run_in_executor(None, functools.partial(
                requests.post, url, json=data))
            alto_resp = yield from alto_resp_future
        except OSError as exc:
            logging.info('Consumed OSError while connecting to ALTO server')
            return

        # Process peers
        ranked_peers = self._process_alto_response(alto_resp)

        # Return results to swarm
        callback(ranked_peers)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号