repo_scan.py 文件源码

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

项目:spdx-github 作者: spdx 项目源码 文件源码
def check_valid_url(repo_zip_url):
    #Check that it's a URL
    if(repo_zip_url[:7] != 'http://' and repo_zip_url[:8] != 'https://'):
        return False
    #Get just the head.
    request = requests.head(repo_zip_url)
    #It should be either success (200's) or redirect(300's).
    #Otherwise, inform the user of failure.
    if (request.status_code >= 400 or request.status_code < 200):
        print('Could not reach URL provided.\n')
        print('Provided url was {} and resulted in status code {}'.format(
              repo_zip_url,str(request.status_code)))
        return False
    else:
        return True

#This sends a notification email based on information provided
#in the environment file
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号