Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 goingtocamp downtime #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion camply/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Camply Command Line Interface
"""

import concurrent
import logging
import sys
from dataclasses import dataclass
Expand All @@ -20,6 +21,7 @@
)

import click
import tenacity
from rich import traceback
from rich_click import RichCommand, RichGroup, rich_click

Expand Down Expand Up @@ -111,7 +113,9 @@ def _set_up_debug(debug: Optional[bool] = None) -> None:
logger.debug("Camply Version: %s", __version__)
logger.debug("Python Version: %s", sys.version.split(" ")[0])
logger.debug("Platform: %s", sys.platform)
traceback.install(show_locals=debug, suppress=[click, rich_click])
traceback.install(
show_locals=debug, suppress=[click, rich_click, tenacity, concurrent]
)


def _preferred_provider(context: CamplyContext, command_provider: Optional[str]) -> str:
Expand Down
9 changes: 9 additions & 0 deletions camply/providers/going_to_camp/going_to_camp_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple, Union

import tenacity
from fake_useragent import UserAgent
from pydantic import ValidationError
from requests.exceptions import Timeout

from camply.containers import AvailableResource, CampgroundFacility, RecreationArea
from camply.containers.base_container import GoingToCampEquipment
Expand Down Expand Up @@ -485,6 +487,13 @@ def list_equipment_types(self, rec_area_id: int) -> Dict[str, int]:
log_sorted_response(response_array=equipment_types)
return equipment_types

@tenacity.retry(
retry=tenacity.retry_if_exception_type((ConnectionError, Timeout)),
wait=tenacity.wait_exponential(multiplier=3, max=1800),
stop=tenacity.stop.stop_after_delay(6000),
before_sleep=tenacity.before_sleep_log(logger, logging.WARNING),
reraise=True,
)
def list_site_availability(
self,
campground: CampgroundFacility,
Expand Down
Loading