aboutsummaryrefslogtreecommitdiff
path: root/management/parsers/ups2017.py
diff options
context:
space:
mode:
authorAlban Gruin2018-08-25 23:01:31 +0200
committerAlban Gruin2018-09-03 19:19:54 +0200
commit77b6ade4a7d465ca0fbc6b82950f3b54689d60e3 (patch)
tree120fe20233fb3a506e5c1ae30bf57645a7f1ca22 /management/parsers/ups2017.py
parente7f2ccdd870f998b9199b85bf2c486f8d1d0cceb (diff)
parsers: déplacement de delete_courses_in_week() vers timetable.py
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
Diffstat (limited to 'management/parsers/ups2017.py')
-rw-r--r--management/parsers/ups2017.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/management/parsers/ups2017.py b/management/parsers/ups2017.py
index 94c1918..8522793 100644
--- a/management/parsers/ups2017.py
+++ b/management/parsers/ups2017.py
@@ -20,7 +20,6 @@ from bs4 import BeautifulSoup
from django.utils import timezone
from ...models import Course, Group, Room
-from ...utils import get_week
import requests
import edt
@@ -32,12 +31,6 @@ def add_time(date, time):
return date + delta
-def delete_courses_in_week(source, year, week, today):
- start, end = get_week(year, week)
- Course.objects.filter(begin__gte=max(start, today), begin__lt=end,
- source=source).delete()
-
-
def get_event(source, event, event_week, today):
"""Renvoie une classe Course à partir d’un événement récupéré par BS4"""
# On récupère la date de l’évènement à partir de la semaine
@@ -155,7 +148,7 @@ def get_weeks(soup):
return weeks
-def get_xml(url):
+def get_source(url):
user_agent = "celcatsanitizer/" + edt.VERSION
req = requests.get(url, headers={"User-Agent": user_agent})
req.encoding = "utf8"