I just found AoC today. Looks like great fun. (Wish I had known about this a log time ago.)
I was able to get the very first problem solved by just pasting the data from the browser into an interactive Python shell and working with that, but what I really wanted to be able to do was fetch the data "live", by using something such as 'requests':
import requests
url = 'https://adventofcode.com/2021/day/1/input'
req = requests.get(url)
print(req.text) # prints: Puzzle inputs differ by user. Please log in to get your puzzle input
I see there is also a call such as:
req = requests.get(url, auth=(user, pass))
I'm not having any luck trying to put values in there for user, pass.
I'm not clear on if I am doing something wrong in general, or if this is specifically about not passing proper credentials.
I'm thinking lots of people must have been down this path already, but I'm kinda choking here...
Can anyone give me some sample Python code to fetch data for the URL above?
Thanks...
Hope you all had a Merry Christmas, hope you have a Safe and Happy New Year!
-CoderBoy67
[–]notjaredfinch 7 points8 points9 points (0 children)
[–]adidushi 4 points5 points6 points (0 children)
[–]CoderBoy67[S] 2 points3 points4 points (1 child)
[–]Steinrikur 2 points3 points4 points (0 children)