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):
|
2021-10-03 15:35:17 -04:00
|
|
|
"""CPAN class"""
|
|
|
|
|
|
|
|
@staticmethod
|
2021-10-03 15:44:08 -04:00
|
|
|
def check(data, project, current_time):
|
2021-10-03 15:35:17 -04:00
|
|
|
res_json = requests.get("http://mirrors.cpan.org/cpan-json.txt").json()
|
|
|
|
for mirror in res_json:
|
|
|
|
if mirror["url"] == f"{CSC_MIRROR}CPAN/":
|
2022-02-16 12:37:24 -05:00
|
|
|
data[project]["out_of_sync_since"] = int(mirror["age"])
|
|
|
|
return current_time - data[project]["out_of_sync_since"] <= data[project]["out_of_sync_interval"]
|
2021-10-03 15:35:17 -04:00
|
|
|
return False
|