common.py 文件源码

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

项目:neo 作者: Sausky 项目源码 文件源码
def get_location(url):
    try:
        response = request.urlopen(url)
        # urllib will follow redirections and it's too much code to tell urllib
        # not to do that
        return response.geturl()
    except socket.timeout:
        print('request timeout')
        exit()
    except request.HTTPError as e:
        print(e.code)
    except request.URLError as e:
        print(e.reason)
        exit()

    return "fail"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号