diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index f58a8ee8..dc6a948c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -40,8 +40,8 @@ jobs: camply recreation-areas --search "Yosemite National Park" camply campgrounds --rec-area 2991 camply campgrounds --search "Fire Tower Lookout" --state CA - camply campsites --rec-area 2991 --start-date 2021-09-15 --end-date 2021-09-16 - camply campsites --campground 252037 --start-date 2021-09-15 --end-date 2021-09-16 + camply campsites --rec-area 2991 --start-date 2021-09-15 --end-date 2021-09-17 + camply campsites --campground 252037 --start-date 2021-09-15 --end-date 2021-09-17 camply campsites --yml-config tests/yml/example_search.yml - camply campsites --campground 232045 --start-date 2021-07-15 --end-date 2021-09-30 --nights 5 - camply campsites --provider yellowstone --start-date 2021-10-10 --end-date 2021-10-15 --nights 2 + camply campsites --campground 232045 --start-date 2021-07-15 --end-date 2021-10-01 --nights 5 + camply campsites --provider yellowstone --start-date 2021-10-10 --end-date 2021-10-16 diff --git a/CHANGELOG.md b/CHANGELOG.md index f8e2dd45..43607df0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ To request new features or bugfixes the [Camply Feedback for v1.0.0 Discussion](https://github.com/juftin/camply/discussions/12) is the best place to go. +## [0.1.8] - 2021-07-20 + +### Added + +- Converted `End Date` to be the checkout date instead of the final camping date. + ## [0.1.7] - 2021-06-24 ### Fixed @@ -88,6 +94,8 @@ place to go. [unreleased]: https://github.com/juftin/camply/compare/main...integration +[0.1.8]: https://github.com/juftin/camply/compare/v0.1.7...v0.1.8 + [0.1.7]: https://github.com/juftin/camply/compare/v0.1.6...v0.1.7 [0.1.6]: https://github.com/juftin/camply/compare/v0.1.5...v0.1.6 diff --git a/Dockerfile b/Dockerfile index 496a3610..80df6885 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.8-slim MAINTAINER Justin Flannery -LABEL version="0.1.7" +LABEL version="0.1.8" LABEL description="camply, the campsite finder" COPY . /tmp/camply diff --git a/README.md b/README.md index a3261828..87924586 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e + `YYYY-MM-DD`: Start of Search window. You will be arriving this day. [**_example_](#searching-for-a-campsite) * `--end-date`: `END_DATE` - + `YYYY-MM-DD`: End of Search window. You will be leaving the following day. + + `YYYY-MM-DD`: End of Search window. You will be checking out this day.. [**_example_](#searching-for-a-campsite) * `--weekends` + Only search for weekend bookings (Fri/Sat nights). @@ -180,7 +180,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e camply campsites \ --rec-area 2725 \ --start-date 2021-07-10 \ - --end-date 2021-07-17 + --end-date 2021-07-18 ``` ### `recreation-areas` @@ -257,7 +257,7 @@ after `--end-date`. camply campsites \ --rec-area 2725 \ --start-date 2021-07-10 \ - --end-date 2021-07-17 + --end-date 2021-07-18 ``` #### Searching for a Campsite by Campground ID @@ -272,7 +272,7 @@ camply campsites \ --campground 251869 \ --campground 232492 \ --start-date 2021-07-10 \ - --end-date 2021-07-17 + --end-date 2021-07-18 ``` #### Continuously Searching for A Campsite @@ -292,7 +292,7 @@ this behavior and send all notifications, pass the `--notify-first-try` argument camply campsites \ --rec-area 2725 \ --start-date 2021-07-12 \ - --end-date 2021-07-12 \ + --end-date 2021-07-13 \ --continuous \ --notifications pushover \ --notify-first-try @@ -310,7 +310,7 @@ problematic when certain campsites become available more than once. camply campsites \ --rec-area 2725 \ --start-date 2021-07-01 \ - --end-date 2021-07-31 \ + --end-date 2021-08-01 \ --continuous \ --notifications pushover \ --search-forever @@ -330,7 +330,7 @@ command) or though environment variables (`PUSHBULLET_API_TOKEN`). camply campsites \ --rec-area 2991 \ --start-date 2021-09-10 \ - --end-date 2021-09-20 \ + --end-date 2021-09-21 \ --continuous \ --notifications pushbullet ``` @@ -345,7 +345,7 @@ checks every 5 minutes instead of the default 10 minutes. camply campsites \ --rec-area 2991 \ --start-date 2021-05-01 \ - --end-date 2021-07-31 \ + --end-date 2021-08-01 \ --weekends \ --continuous \ --notifications email \ @@ -366,7 +366,7 @@ more than this your `--nights` parameter will be overwritten to 2. camply campsites \ --rec-area 2991 \ --start-date 2021-05-01 \ - --end-date 2021-07-31 \ + --end-date 2021-08-01 \ --nights 4 ``` @@ -383,7 +383,7 @@ this [discussion](https://github.com/juftin/camply/discussions/15#discussioncomm camply campsites \ --provider yellowstone \ --start-date 2021-07-09 \ - --end-date 2021-07-16 \ + --end-date 2021-07-17 \ --continuous ``` @@ -398,7 +398,7 @@ camply campsites \ --rec-area 2991 \ --rec-area 1074 \ --start-date 2021-07-09 \ - --end-date 2021-07-16 \ + --end-date 2021-07-17 \ --nights 5 ``` @@ -414,7 +414,7 @@ recreation_area: # (LIST OR SINGLE ENTRY) - 1074 # Sierra National Forest, CA (All Campgrounds) campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED. # (LIST OR SINGLE ENTRY) start_date: 2021-09-12 # YYYY-MM-DD -end_date: 2021-09-12 # YYYY-MM-DD +end_date: 2021-09-13 # YYYY-MM-DD weekends: False # FALSE BY DEFAULT nights: 1 # 1 BY DEFAULT continuous: True # DEFAULTS TO TRUE @@ -565,7 +565,7 @@ docker run -d \ camply campsites \ --rec-area 2991 \ --start-date 2021-08-01 \ - --end-date 2021-08-31 \ + --end-date 2021-09-01 \ --continuous \ --notifications pushover ``` @@ -602,7 +602,7 @@ docker run \ camply campsites \ --provider yellowstone \ --start-date 2021-07-22 \ - --end-date 2021-07-26 \ + --end-date 2021-07-27 \ --continuous \ --notifications email ``` @@ -646,6 +646,10 @@ dependencies: - [PyYAML](https://pyyaml.org/) - PyYAML is a YAML parsing library - this helps with the YAML file campsite searches. +
+ +Recreation data provided by [**Recreation.gov**](https://ridb.recreation.gov/) + ___________ ___________ diff --git a/camply/__init__.py b/camply/__init__.py index 75503aef..edd30aba 100644 --- a/camply/__init__.py +++ b/camply/__init__.py @@ -6,4 +6,4 @@ camply __init__ file """ -__version__ = "0.1.7" +__version__ = "0.1.8" diff --git a/camply/config/cli_config.py b/camply/config/cli_config.py index c67b5b73..a822aa86 100644 --- a/camply/config/cli_config.py +++ b/camply/config/cli_config.py @@ -56,7 +56,7 @@ class CommandLineArguments: END_DATE_ARGUMENT: str = "--end-date" END_DATE_DESTINATION: str = "end_date" - END_DATE_HELP: str = "(YYYY-MM-DD) End of Search window. You will be leaving the following day." + END_DATE_HELP: str = "(YYYY-MM-DD) End of Search window. You will be checking out this day." WEEKENDS_ARGUMENT: str = "--weekends" WEEKENDS_DESTINATION: str = "weekends" diff --git a/camply/search/base_search.py b/camply/search/base_search.py index 4e8415bc..50a917d4 100644 --- a/camply/search/base_search.py +++ b/camply/search/base_search.py @@ -368,7 +368,7 @@ def _get_search_days(self) -> List[datetime]: search_days = set() for window in self.search_window: generated_dates = set() - for index in range(0, (window.end_date - window.start_date).days + 1): + for index in range(0, (window.end_date - window.start_date).days): search_day = window.start_date search_day = search_day.replace(hour=0, minute=0, second=0, microsecond=0) + timedelta(days=index) @@ -383,7 +383,7 @@ def _get_search_days(self) -> List[datetime]: search_days.remove(search_date) number_searches = len(search_days) if number_searches > 0: - logger.info(f"{len(search_days)} dates selected for search, " + logger.info(f"{len(search_days)} booking nights selected for search, " f"ranging from {min(search_days).strftime('%Y-%m-%d')} to " f"{max(search_days).strftime('%Y-%m-%d')}") else: @@ -426,7 +426,7 @@ def _consolidate_campsites(cls, campsite_df: DataFrame, Returns ------- - DataFrame + List[AvailableCampsite] """ composed_groupings = list() for _, campsite_slice in campsite_df.groupby( @@ -508,7 +508,7 @@ def _find_consecutive_nights(cls, dataframe: DataFrame, nights: int) -> DataFram concatted_data = [DataFrame()] return concat(concatted_data, ignore_index=True) - def _validate_consecutive_nights(self, nights: int) -> None: + def _validate_consecutive_nights(self, nights: int) -> int: """ Validate the number of consecutive nights to search @@ -594,7 +594,7 @@ def assemble_availabilities(cls, matching_data: List[AvailableCampsite], log: bo return availability_df @classmethod - def _log_availabilities(cls, availability_df: DataFrame, verbose: bool) -> None: + def _log_availabilities(cls, availability_df: DataFrame, verbose: bool) -> DataFrame: """ Log the Availabilities @@ -605,7 +605,7 @@ def _log_availabilities(cls, availability_df: DataFrame, verbose: bool) -> None: Returns ------- - None + DataFrame """ booking_date: datetime for booking_date, available_sites in availability_df.groupby("booking_date"): diff --git a/docs/README.docker.md b/docs/README.docker.md index 01746185..a0fe90bb 100644 --- a/docs/README.docker.md +++ b/docs/README.docker.md @@ -59,7 +59,7 @@ docker run -d \ camply campsites \ --rec-area 2991 \ --start-date 2021-08-01 \ - --end-date 2021-08-31 \ + --end-date 2021-09-01 \ --continuous \ --notifications pushover ``` @@ -96,7 +96,7 @@ docker run \ camply campsites \ --provider yellowstone \ --start-date 2021-07-22 \ - --end-date 2021-07-26 \ + --end-date 2021-07-27 \ --continuous \ --notifications email ``` @@ -179,7 +179,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e + `YYYY-MM-DD`: Start of Search window. You will be arriving this day. [**_example_](#searching-for-a-campsite) * `--end-date`: `END_DATE` - + `YYYY-MM-DD`: End of Search window. You will be leaving the following day. + + `YYYY-MM-DD`: End of Search window. You will be checking out this day. [**_example_](#searching-for-a-campsite) * `--weekends` + Only search for weekend bookings (Fri/Sat nights). @@ -224,7 +224,7 @@ and a link to make the booking. Required parameters include `--start-date`, `--e camply campsites \ --rec-area 2725 \ --start-date 2021-07-10 \ - --end-date 2021-07-17 + --end-date 2021-07-18 ``` ### `recreation-areas` @@ -301,7 +301,7 @@ after `--end-date`. camply campsites \ --rec-area 2725 \ --start-date 2021-07-10 \ - --end-date 2021-07-17 + --end-date 2021-07-18 ``` #### Searching for a Campsite by Campground ID @@ -316,7 +316,7 @@ camply campsites \ --campground 251869 \ --campground 232492 \ --start-date 2021-07-10 \ - --end-date 2021-07-17 + --end-date 2021-07-18 ``` #### Continuously Searching for A Campsite @@ -336,7 +336,7 @@ this behavior and send all notifications, pass the `--notify-first-try` argument camply campsites \ --rec-area 2725 \ --start-date 2021-07-12 \ - --end-date 2021-07-12 \ + --end-date 2021-07-13 \ --continuous \ --notifications pushover \ --notify-first-try @@ -354,7 +354,7 @@ problematic when certain campsites become available more than once. camply campsites \ --rec-area 2725 \ --start-date 2021-07-01 \ - --end-date 2021-07-31 \ + --end-date 2021-08-01 \ --continuous \ --notifications pushover \ --search-forever @@ -374,7 +374,7 @@ command) or though environment variables (`PUSHBULLET_API_TOKEN`). camply campsites \ --rec-area 2991 \ --start-date 2021-09-10 \ - --end-date 2021-09-20 \ + --end-date 2021-09-21 \ --continuous \ --notifications pushbullet ``` @@ -389,7 +389,7 @@ checks every 5 minutes instead of the default 10 minutes. camply campsites \ --rec-area 2991 \ --start-date 2021-05-01 \ - --end-date 2021-07-31 \ + --end-date 2021-08-01 \ --weekends \ --continuous \ --notifications email \ @@ -410,7 +410,7 @@ more than this your `--nights` parameter will be overwritten to 2. camply campsites \ --rec-area 2991 \ --start-date 2021-05-01 \ - --end-date 2021-07-31 \ + --end-date 2021-08-01 \ --nights 4 ``` @@ -427,7 +427,7 @@ this [discussion](https://github.com/juftin/camply/discussions/15#discussioncomm camply campsites \ --provider yellowstone \ --start-date 2021-07-09 \ - --end-date 2021-07-16 \ + --end-date 2021-07-17 \ --continuous ``` @@ -442,7 +442,7 @@ camply campsites \ --rec-area 2991 \ --rec-area 1074 \ --start-date 2021-07-09 \ - --end-date 2021-07-16 \ + --end-date 2021-07-17 \ --nights 5 ``` @@ -458,7 +458,7 @@ recreation_area: # (LIST OR SINGLE ENTRY) - 1074 # Sierra National Forest, CA (All Campgrounds) campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED. # (LIST OR SINGLE ENTRY) start_date: 2021-09-12 # YYYY-MM-DD -end_date: 2021-09-12 # YYYY-MM-DD +end_date: 2021-09-13 # YYYY-MM-DD weekends: False # FALSE BY DEFAULT nights: 1 # 1 BY DEFAULT continuous: True # DEFAULTS TO TRUE diff --git a/docs/examples/example_search.yml b/docs/examples/example_search.yml index 92ef3f89..9359665e 100644 --- a/docs/examples/example_search.yml +++ b/docs/examples/example_search.yml @@ -4,7 +4,7 @@ recreation_area: # (LIST OR SINGLE ENTRY) - 1074 # Sierra National Forest, CA (All Campgrounds) campgrounds: null # OVERRIDES RECREATION AREA (LIST OR SINGLE ENTRY) start_date: 2021-09-12 # YYYY-MM-DD -end_date: 2021-09-12 # YYYY-MM-DD +end_date: 2021-09-13 # YYYY-MM-DD weekends: False # FALSE BY DEFAULT nights: 1 # 1 BY DEFAULT continuous: False # DEFAULTS TO TRUE diff --git a/pyproject.toml b/pyproject.toml index 37ec8aaf..d3e059a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "camply" -version = "0.1.7" +version = "0.1.8" description = "camply, the campsite finder ⛺️" authors = ["Justin Flannery "] maintainers = ["Justin Flannery "] diff --git a/tests/search_providers/test_recdotgov_search.py b/tests/search_providers/test_recdotgov_search.py index c1e425b6..a08797e8 100644 --- a/tests/search_providers/test_recdotgov_search.py +++ b/tests/search_providers/test_recdotgov_search.py @@ -32,7 +32,7 @@ def search_window() -> SearchWindow: minute=0, second=0, microsecond=0) search_window = SearchWindow(start_date=beginning_of_next_month, - end_date=beginning_of_next_month + timedelta(days=28)) + end_date=beginning_of_next_month + timedelta(days=29)) logger.info("Setting Up Search Window starting Next Month: " f"{search_window.start_date.strftime('%B, %Y')}") return search_window diff --git a/tests/search_providers/test_yellowstone_search.py b/tests/search_providers/test_yellowstone_search.py index fc00f247..5d47d665 100644 --- a/tests/search_providers/test_yellowstone_search.py +++ b/tests/search_providers/test_yellowstone_search.py @@ -32,7 +32,7 @@ def search_window() -> SearchWindow: minute=0, second=0, microsecond=0) search_window = SearchWindow(start_date=beginning_of_next_month, - end_date=beginning_of_next_month + timedelta(days=14)) + end_date=beginning_of_next_month + timedelta(days=15)) logger.info("Setting Up Search Window starting Next Month: " f"{search_window.start_date.strftime('%B, %Y')}") return search_window diff --git a/tests/yml/example_search.yml b/tests/yml/example_search.yml index fb3b6067..bbb90e92 100644 --- a/tests/yml/example_search.yml +++ b/tests/yml/example_search.yml @@ -3,6 +3,6 @@ recreation_area: # (LIST OR SINGLE ENTRY) - 2907 # ROCKY MOUNTAIN NATIONAL PARK campgrounds: null # OVERRIDES RECREATION AREA (LIST OR SINGLE ENTRY) start_date: 2021-09-10 # YYYY-MM-DD -end_date: 2021-09-10 # YYYY-MM-DD +end_date: 2021-09-11 # YYYY-MM-DD weekends: False # FALSE BY DEFAULT continuous: False # DEFAULTS TO TRUE