-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Took 1 minute
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from aoc import AdventOfCode, AdventOfCodeTask | ||
|
||
|
||
class ExampleTask(AdventOfCodeTask): | ||
def run(self): | ||
# This method is called on execute | ||
pass | ||
|
||
|
||
def main(): | ||
instance = AdventOfCode(2022) # Create instance of library with current year | ||
instance.enable_auto_input_fetch("<session_token>") # We can enable auto fetching input, session token can be obtained from browser cookies | ||
instance.enable_auto_input_fetch("<session_token>", True) # Also we can enable caching for these requests, it will download input to cache folder and use it on next run | ||
instance.enable_auto_input_fetch("<session_token>", True, "/temp") # Cache directory can be changed by third parameter, '/' means working folder | ||
|
||
instance.register_task(1, ExampleTask) # Register task to specific day | ||
|
||
instance.execute(1) # Now we can execute task on that day by running this command, this will call run() method in task class | ||
instance.execute_all() # This is the same as above, but it will run all days one by one | ||
instance.execute_last() # This will execute only last day task that was added | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |