Start solving 2018 problems
I have also updated get.py to download the problems as
`d<day>.txt` instead of `i<day>.txt`. That allows me
to get the day input via `__input__.replace('.py', '.txt')`
which is a little more concise. I don't know why
I didn't do this earlier.
This commit is contained in:
4
get.py
4
get.py
@@ -12,12 +12,14 @@ year = sys.argv[1]
|
||||
day = sys.argv[2]
|
||||
|
||||
session_cookie = get_password('aoc-session-cookie', 'felixm')
|
||||
assert session_cookie is not None
|
||||
|
||||
url = f"https://adventofcode.com/{year}/day/{day}/input"
|
||||
cookies = {'session': session_cookie}
|
||||
response = requests.get(url, cookies=cookies)
|
||||
|
||||
if response.status_code == 200:
|
||||
filename = f"i{day}.txt"
|
||||
filename = f"d{day}.txt"
|
||||
with open(filename, 'w') as file:
|
||||
file.write(response.text)
|
||||
print(f"Year {year} {filename} written.")
|
||||
|
||||
Reference in New Issue
Block a user