aoc-input-fetcher


Nameaoc-input-fetcher JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/mourud/aoc-input-fetcher
SummaryA useful tool for getting the input automatically for Advent of Code, given you follow the file structure
upload_time2024-12-11 23:40:36
maintainerNone
docs_urlNone
authorMourud Ishmam Ahmed
requires_python>=3.6
licenseNone
keywords advent of code input fetcher automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Advent of Code Input Fetcher

`aoc_input_fetcher` is a Python package that automates fetching input files for [Advent of Code](https://adventofcode.com) challenges, assuming a specific file structure for your project.

---

## Features

- Automatically fetches input for Advent of Code puzzles from file name and directory sturcture.
- Supports user-provided session cookies for authentication.
- Simplifies managing input files for each day of the challenge.
- Easy to integrate with your existing workflow.

---

## Installation

You can install the package via pip:

```bash
pip install aoc_input_fetcher
```

## Usage

### Setup

To use aoc_input_fetcher, you need to:
	1.	Log in to Advent of Code and copy your session cookie.
	2.	Save the cookie to a .env file in the following format:
```bash
AOC_COOKIE=<your_session_cookie>
```


### File Structure

The package expects the following file structure for your Advent of Code project:


```
aoc/2024/
├── day1.py
├── day5.py
├── inputs/
│   ├── day1.txt
│   └── day5.txt
```
### Fetch Input

Example of fetching input for Day 1:
```python
from aoc_input_fetcher import fetch_input

input = fetch_input(__input__)
```
This will download the input for Day 1 and save it to inputs/day1.txt in the project root. The input is returned as a string as well.

**Demo**

Here’s a quick demo of how to use the package:

from aoc_input_fetcher import fetch_input
```python
from aoc_input_fetcher import fetch_input

def main():
    input = fetch_input(__file__)
    if input is None:
        return
    formatted_input = format_input(input)
    print(part1(formatted_input))
    print(part2(formatted_input))
main()
```
For a detailed look at how I have been using it check out my [Advent of Code repository](https://github.com/mourud/advent-of-code/tree/main/2024)

## Requirements
This package requires:
	•	Python 3.6 or newer
	•	requests library (automatically installed with the package)
    •   python-dotenv library (automatically installed with the package)

## Contributing
Contributions are welcome! If you have ideas for improvements or find bugs:
	1.	Fork the repository.
	2.	Make your changes.
	3.	Submit a pull request.

## License
This project is licensed under the MIT License. See the LICENSE file for details.

## Support
If you encounter issues or have questions, feel free to open an issue on GitHub.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mourud/aoc-input-fetcher",
    "name": "aoc-input-fetcher",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Advent of Code, input fetcher, automation",
    "author": "Mourud Ishmam Ahmed",
    "author_email": "ishmam1@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/29/53/87fa88e92d6cbb6788274023f15d42d233a9257b9334a27c9f5ea11638a9/aoc_input_fetcher-0.1.2.tar.gz",
    "platform": null,
    "description": "# Advent of Code Input Fetcher\n\n`aoc_input_fetcher` is a Python package that automates fetching input files for [Advent of Code](https://adventofcode.com) challenges, assuming a specific file structure for your project.\n\n---\n\n## Features\n\n- Automatically fetches input for Advent of Code puzzles from file name and directory sturcture.\n- Supports user-provided session cookies for authentication.\n- Simplifies managing input files for each day of the challenge.\n- Easy to integrate with your existing workflow.\n\n---\n\n## Installation\n\nYou can install the package via pip:\n\n```bash\npip install aoc_input_fetcher\n```\n\n## Usage\n\n### Setup\n\nTo use aoc_input_fetcher, you need to:\n\t1.\tLog in to Advent of Code and copy your session cookie.\n\t2.\tSave the cookie to a .env file in the following format:\n```bash\nAOC_COOKIE=<your_session_cookie>\n```\n\n\n### File Structure\n\nThe package expects the following file structure for your Advent of Code project:\n\n\n```\naoc/2024/\n\u251c\u2500\u2500 day1.py\n\u251c\u2500\u2500 day5.py\n\u251c\u2500\u2500 inputs/\n\u2502   \u251c\u2500\u2500 day1.txt\n\u2502   \u2514\u2500\u2500 day5.txt\n```\n### Fetch Input\n\nExample of fetching input for Day 1:\n```python\nfrom aoc_input_fetcher import fetch_input\n\ninput = fetch_input(__input__)\n```\nThis will download the input for Day 1 and save it to inputs/day1.txt in the project root. The input is returned as a string as well.\n\n**Demo**\n\nHere\u2019s a quick demo of how to use the package:\n\nfrom aoc_input_fetcher import fetch_input\n```python\nfrom aoc_input_fetcher import fetch_input\n\ndef main():\n    input = fetch_input(__file__)\n    if input is None:\n        return\n    formatted_input = format_input(input)\n    print(part1(formatted_input))\n    print(part2(formatted_input))\nmain()\n```\nFor a detailed look at how I have been using it check out my [Advent of Code repository](https://github.com/mourud/advent-of-code/tree/main/2024)\n\n## Requirements\nThis package requires:\n\t\u2022\tPython 3.6 or newer\n\t\u2022\trequests library (automatically installed with the package)\n    \u2022   python-dotenv library (automatically installed with the package)\n\n## Contributing\nContributions are welcome! If you have ideas for improvements or find bugs:\n\t1.\tFork the repository.\n\t2.\tMake your changes.\n\t3.\tSubmit a pull request.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Support\nIf you encounter issues or have questions, feel free to open an issue on GitHub.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A useful tool for getting the input automatically for Advent of Code, given you follow the file structure",
    "version": "0.1.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/mourud/aoc-input-fetcher/issues",
        "Documentation": "https://github.com/mourud/aoc-input-fetcher#readme",
        "Homepage": "https://github.com/mourud/aoc-input-fetcher"
    },
    "split_keywords": [
        "advent of code",
        " input fetcher",
        " automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cea25eed345cfc6dc608e0d5281aa3eace48813d45de88957520ceb58eb27770",
                "md5": "79a41cce940b37119285e7583104a684",
                "sha256": "a55b9256654b11a788513c5777b858797b68df5d3beb366fd5081514a92ce028"
            },
            "downloads": -1,
            "filename": "aoc_input_fetcher-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "79a41cce940b37119285e7583104a684",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4182,
            "upload_time": "2024-12-11T23:40:34",
            "upload_time_iso_8601": "2024-12-11T23:40:34.287099Z",
            "url": "https://files.pythonhosted.org/packages/ce/a2/5eed345cfc6dc608e0d5281aa3eace48813d45de88957520ceb58eb27770/aoc_input_fetcher-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "295387fa88e92d6cbb6788274023f15d42d233a9257b9334a27c9f5ea11638a9",
                "md5": "955c313faef733d274f200ceefe62942",
                "sha256": "86d13ec3d60e2d9ffbcce95a18e3621b98872914e66605c5b3c181cc0278d775"
            },
            "downloads": -1,
            "filename": "aoc_input_fetcher-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "955c313faef733d274f200ceefe62942",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3667,
            "upload_time": "2024-12-11T23:40:36",
            "upload_time_iso_8601": "2024-12-11T23:40:36.653728Z",
            "url": "https://files.pythonhosted.org/packages/29/53/87fa88e92d6cbb6788274023f15d42d233a9257b9334a27c9f5ea11638a9/aoc_input_fetcher-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 23:40:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mourud",
    "github_project": "aoc-input-fetcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aoc-input-fetcher"
}
        
Elapsed time: 1.15701s