mirror-checker/projects/cpan.py

23 lines
641 B
Python
Raw Permalink Normal View History

2021-10-03 15:35:17 -04:00
"""
Contains CPAN class
"""
import requests
2021-10-03 15:44:08 -04:00
from project import Project
2021-10-03 15:35:17 -04:00
from shared import CSC_MIRROR
2021-10-03 15:44:08 -04:00
class CPAN(Project):
"""CPAN class"""
2021-10-03 15:35:17 -04:00
@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