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
评论列表
文章目录