forked from public/mirror-checker
parent
1b53f605c9
commit
8195cbb042
@ -0,0 +1,26 @@ |
||||
""" |
||||
Contains mxlinux class |
||||
""" |
||||
|
||||
import os |
||||
from project import Project |
||||
from shared import CSC_MIRROR |
||||
import requests |
||||
import datefinder # another date finding library |
||||
from datetime import timedelta |
||||
from datetime import datetime |
||||
import re |
||||
import pandas as pd |
||||
|
||||
class mxlinux(Project): |
||||
"""mxlinux class""" |
||||
@staticmethod |
||||
def check(data, project, current_time): |
||||
page = requests.get(data[project]["upstream"]).text |
||||
indexOfFile = page.find("mirror.csclub.uwaterloo.ca") |
||||
|
||||
m = re.search(r'(\d+ hours)|(\d+(\.)?\d+ days)', page[indexOfFile:]) # solution from: https://stackoverflow.com/questions/21074100/how-to-convert-standard-timedelta-string-to-timedelta-object/21074460 |
||||
|
||||
duration = pd.to_timedelta(m.group(0)) |
||||
|
||||
return duration <= pd.to_timedelta(data[project]["out_of_sync_interval"], unit='s') |
@ -0,0 +1,26 @@ |
||||
""" |
||||
Contains mxlinux_iso class |
||||
""" |
||||
|
||||
import os |
||||
from project import Project |
||||
from shared import CSC_MIRROR |
||||
import requests |
||||
import datefinder # another date finding library |
||||
from datetime import timedelta |
||||
from datetime import datetime |
||||
import re |
||||
import pandas as pd |
||||
|
||||
class mxlinux_iso(Project): |
||||
"""mxlinux_iso class""" |
||||
@staticmethod |
||||
def check(data, project, current_time): |
||||
page = requests.get(data[project]["upstream"]).text |
||||
indexOfFile = page.find("mirror.csclub.uwaterloo.ca") |
||||
|
||||
m = re.search(r'(\d+ hours)|(\d+(\.)?\d+ days)', page[indexOfFile:]) # solution from: https://stackoverflow.com/questions/21074100/how-to-convert-standard-timedelta-string-to-timedelta-object/21074460 |
||||
|
||||
duration = pd.to_timedelta(m.group(0)) |
||||
|
||||
return duration <= pd.to_timedelta(data[project]["out_of_sync_interval"], unit='s') |
Loading…
Reference in new issue