Skip to content
Snippets Groups Projects
Commit e80ab8a7 authored by Alban Gruin's avatar Alban Gruin
Browse files

Envoi d’un user-agent personnalisé

parent 494e8150
Branches
Tags
No related merge requests found
......@@ -23,6 +23,7 @@
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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment