netconf.py 文件源码

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

项目:pathman-sr 作者: CiscoDevNet 项目源码 文件源码
def get_url(url):
    '''request url'''
    headers = {'Content-type': 'application/json'}
    auth = (controller['any_user'], controller['any_pass'])
    logging.info(url)
    try:
        response = requests.get(url, headers=headers, auth=auth, verify=False)
        logging.info("Url GET Status: %s" % response.status_code)

        if response.status_code in [200]:
            return True, response.json()
        else:
            return False, str(response.text)
    except requests.exceptions.ConnectionError, e:
        logging.error('Connection Error: %s' % e.message)
        return False, str(e.message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号