mirror-checker/projects/cpan.py

23 lines
641 B
Python

"""
Contains CPAN class
"""
import requests
from project import Project
from shared import CSC_MIRROR
class CPAN(Project):
"""CPAN class"""
@staticmethod
def check(data, project, current_time):
res_json = requests.get("http://mirrors.cpan.org/cpan-json.txt").json()
for mirror in res_json:
if mirror["url"] == f"{CSC_MIRROR}CPAN/" and mirror["last_status"] == "ok":
# This is an improvised method: report we're good if CPAN think we are good
# Change this to a more precise method if you find a better way to do it
return True
return False