Skip to content

Commit 2f4bed2

Browse files
committed
fix: holiday URL
1 parent b8ce54e commit 2f4bed2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

utils/dates.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ def get_holidates() -> (list[datetime], list[str, datetime]):
3131
scrapes holiday list from IITKGP website
3232
returns: list of holidays as occasions and datetime objects
3333
"""
34+
headers = {
35+
"timeout": "20",
36+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/51.0.2704.79 Chrome/51.0.2704.79 Safari/537.36",
37+
}
3438
url = "https://www.iitkgp.ac.in/holidays"
35-
result = requests.get(url).text
39+
result = requests.get(url=url, headers=headers).text
3640
doc = bs(result, "html.parser")
3741
tbody = doc.tbody
3842
trs = tbody.contents
@@ -182,4 +186,4 @@ def get_rfc_time(time: int, day: str, minute: int = 0, second: int = 0) -> str:
182186

183187
for hday in hdays.keys():
184188
hdays[hday].sort()
185-
hdays[hday] = list(set(hdays[hday])) ### datetime dict(list)
189+
hdays[hday] = list(set(hdays[hday])) ### datetime dict(list)

0 commit comments

Comments
 (0)