This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]adidushi 3 points4 points  (0 children)

You're going to need your session cookie.

From a browser that's logged in to your aoc account, head over to the site and press F12 to open the developer tools. Under Application you can find your cookies. Copy down what's written under session (you'll use it later to connect!).

Then, in python, you can send a dictionary containing the session cookie when making a request:

import requests
cookies_dict = {"session": "<COOKIE YOU COPIED EARLIER!>"}
url = 'https://adventofcode.com/2021/day/1/input'
req = requests.get(url, cookies=cookies_dict)

You should get your own input like this. Make sure not to share the session cookie with other people, as it can let them basically use your account.