def acme_enabled(url):
"if given url can be hit and it looks like the acme hidden dir exists, return True."
url = 'http://' + url + "/.well-known/acme-challenge/" # ll: http://lax.elifesciences.org/.well-known/acme-challenge
try:
resp = requests.head(url, allow_redirects=False)
if 'crm.elifesciences' in url:
return resp.status_code == 404 # apache behaves differently to nginx
return resp.status_code == 403 # forbidden rather than not found.
except (requests.ConnectionError, requests.ConnectTimeout):
# couldn't connect for whatever reason
return False
评论列表
文章目录