Check whether our mirror packages are up to date.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
737 B

Contains nongnu class
from project import Project
from shared import CSC_MIRROR
import requests
from datetime import datetime
import time
class nongnu(Project):
"""nongnu class"""
def check(data, project, current_time):
csc_url = CSC_MIRROR + data[project]["csc"] + data[project]["file"]
upstream_url = data[project]["upstream"] + data[project]["file"]
req = requests.get(csc_url)
CSC = req.text
req = requests.get(upstream_url)
upstream = req.text
if upstream == CSC:
return True
return int(upstream.partition('\n')[0]) - int(CSC.partition('\n')[0]) < data[project]["out_of_sync_interval"]
except ValueError:
return False