forked from public/mirror-checker
18 lines
488 B
Python
18 lines
488 B
Python
"""
|
|
Contains CPAN class
|
|
"""
|
|
|
|
import requests
|
|
from distro import Distro
|
|
from shared import CSC_MIRROR
|
|
|
|
class CPAN(Distro):
|
|
"""CPAN class"""
|
|
@staticmethod
|
|
def check(data, distro, 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/":
|
|
return current_time - int(mirror["age"]) <= data[distro]["out_of_sync_interval"]
|
|
return False
|