Skip to content

Commit 3e1b000

Browse files
authored
1 parent 9024d3c commit 3e1b000

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "aoc-main"
33
description = "A macro which defines a handful main for the Advent of Code"
4-
version = "0.4.0"
4+
version = "0.4.1"
55
authors = ["Rémi Dupré <[email protected]>"]
66
repository = "https://github.com/remi-dupre/aoc"
77
license = "Apache-2.0"

src/input.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use std::io::{stdin, stdout};
77
use std::path::{Path, PathBuf};
88
use std::time::Instant;
99

10+
use attohttpc::header::{COOKIE, USER_AGENT};
11+
1012
use crate::utils::Line;
1113

1214
const BASE_URL: &str = "https://adventofcode.com";
15+
const USER_AGENT_VALUE: &str = "github.com/remi-dupre/aoc by [email protected]";
1316

1417
fn input_path(year: u16, day: u8) -> PathBuf {
1518
format!("input/{}/day{}.txt", year, day).into()
@@ -29,9 +32,12 @@ pub fn get_input(year: u16, day: u8) -> Result<String, Box<dyn Error>> {
2932
let start = Instant::now();
3033
let url = format!("{}/{}/day/{}/input", BASE_URL, year, day);
3134
let session_cookie = format!("session={}", get_conn_token()?);
35+
3236
let resp = attohttpc::get(&url)
33-
.header(attohttpc::header::COOKIE, session_cookie)
37+
.header(COOKIE, session_cookie)
38+
.header(USER_AGENT, USER_AGENT_VALUE)
3439
.send()?;
40+
3541
let elapsed = start.elapsed();
3642

3743
println!(

0 commit comments

Comments
 (0)