diff options
author | Alban Gruin | 2017-10-10 21:26:39 +0200 |
---|---|---|
committer | Alban Gruin | 2017-10-10 21:26:39 +0200 |
commit | e80ab8a7232a73d8a0f09f8e41a88893d4c65d63 (patch) | |
tree | a915ddcf69a906f16c8cfb32b76e443a35c348ca /management/commands | |
parent | 494e8150032178ee530c69ef253fd5903544a167 (diff) |
Envoi d’un user-agent personnalisé
Diffstat (limited to 'management/commands')
-rw-r--r-- | management/commands/_private.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/management/commands/_private.py b/management/commands/_private.py index 3b6a164..943a3fb 100644 --- a/management/commands/_private.py +++ b/management/commands/_private.py @@ -23,6 +23,7 @@ from edt.models import Group, Room, Course from edt.utils import get_week import requests +import edt def add_time(date, time): ptime = datetime.datetime.strptime(time, "%H:%M") @@ -194,7 +195,8 @@ def get_weeks(soup): return weeks def get_xml(url): - req = requests.get(url) + user_agent = "celcatsanitizer/" + edt.VERSION + req = requests.get(url, headers={"User-Agent": user_agent}) req.encoding = "utf8" soup = BeautifulSoup(req.content, "html.parser") |