peering_db.py 文件源码

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

项目:arouteserver 作者: pierky 项目源码 文件源码
def _read_from_url(url):
        try:
            response = urlopen(url)
        except HTTPError as e:
            if e.code == 404:
                return "{}"
            else:
                raise PeeringDBError(
                    "HTTP error while retrieving info from PeeringDB: "
                    "code: {}, reason: {} - {}".format(
                        e.code, e.reason, str(e)
                    )
                )
        except Exception as e:
            raise PeeringDBError(
                "Error while retrieving info from PeeringDB: {}".format(
                    str(e)
                )
            )

        return response.read().decode("utf-8")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号