Skip to content

Commit 2db960c

Browse files
authored
Merge pull request #9 from CSSUoB/add-user-agent
2 parents 0177384 + f4aa79a commit 2db960c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
PLAYER_STR_FORMAT = '{rank:2}) {name:{name_pad}} ({points:{points_pad}}) {stars:{stars_pad}}* ({star_time})\n'
2525
URL_STR_FORMAT = 'https://adventofcode.com/{year}/leaderboard/private/view/{leaderboard_id}.json'
2626

27+
USER_AGENT = 'github.com/CSSUoB/advent-of-code-bot by [email protected]'
28+
2729
players_cache = {}
2830

2931

@@ -43,6 +45,7 @@ def get_players(year: int = CURRENT_YEAR):
4345

4446
req = urllib.request.Request(url)
4547
req.add_header('Cookie', 'session=' + COOKIE)
48+
req.add_header('User-Agent', USER_AGENT)
4649

4750
try:
4851
page = urllib.request.urlopen(req).read()

0 commit comments

Comments
 (0)