Skip to content

Commit

Permalink
camply 0.1.2 (#13)
Browse files Browse the repository at this point in the history
* bugfixes from discussion

* move version to __init__.py
  • Loading branch information
juftin authored May 25, 2021
1 parent a5f5b09 commit 0dfeb24
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 18 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ versioning.
- Any bugs that surface will quickly have fixes quickly deployed before version
`1.0.0` is released.

## [0.1.2] - 2021-05-24

### Fixed

- Filter out `Checkout-Only` campsites by excluding `Open` availability status
- No longer trapping all errors with `exit(0)`
- Email notifications now attempt login at start, to throw errors early.

## [0.1.1] - 2021-05-18

### Added
Expand All @@ -35,6 +43,8 @@ versioning.

[unreleased]: https://github.com/juftin/camply/compare/main...integration

[0.1.2]: https://github.com/juftin/camply/compare/v0.1.1...v0.1.2

[0.1.1]: https://github.com/juftin/camply/compare/v0.1.0...v0.1.1

[0.1.0]: https://github.com/juftin/camply/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.8-slim

MAINTAINER Justin Flannery <[email protected]>
LABEL version="0.1.1"
LABEL version="0.1.2"
LABEL description="camply, the campsite finder"

COPY . /tmp/camply
Expand Down
2 changes: 2 additions & 0 deletions camply/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
"""
camply __init__ file
"""

__version__ = "0.1.2"
13 changes: 7 additions & 6 deletions camply/config/api_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ class RecreationBookingConfig:
RATE_LIMITING: float = round(uniform(1.01, 1.51), 2)

CAMPSITE_UNAVAILABLE_STRINGS: list = [
"Reserved",
"Not Available",
"Not Reservable",
"Not Reservable Management",
"Not Available Cutoff",
"Lottery"
"Reserved"
, "Not Available"
, "Not Reservable"
, "Not Reservable Management"
, "Not Available Cutoff"
, "Lottery"
, "Open"
]

CAMPSITE_BASE: str = "campsites"
Expand Down
3 changes: 2 additions & 1 deletion camply/config/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from dotenv import load_dotenv

from camply import __version__ as camply_version
from camply.config.file_config import FileConfig
from camply.config.search_config import SearchConfig

Expand Down Expand Up @@ -122,7 +123,7 @@ class CommandLineConfig(CommandLineActions, CommandLineArguments, CommandLineVal
"""

CAMPLY_APP_NAME: str = "camply"
CAMPLY_APP_VERSION: str = "0.1.1"
CAMPLY_APP_VERSION: str = camply_version
CAMPLY_DESCRIPTION: str = "camply, the campsite finder"
CAMPLY_EXIT_MESSAGE: str = "Exiting camply 👋"

Expand Down
32 changes: 25 additions & 7 deletions camply/notifications/email_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ class EmailNotifications(BaseNotifications, ABC):
Notifications via Email
"""

email_subject = EmailConfig.EMAIL_SUBJECT_LINE
email_from = EmailConfig.EMAIL_FROM_ADDRESS
email_to = EmailConfig.EMAIL_TO_ADDRESS
email_username = EmailConfig.EMAIL_USERNAME
_email_password = EmailConfig.EMAIL_PASSWORD
email_smtp_server = EmailConfig.EMAIL_SMTP_SERVER
email_smtp_server_port = EmailConfig.EMAIL_SMTP_PORT

def __init__(self):
"""
Data Validation
**kwargs
Accepts: from, to, subject, username, password, server, port
"""
# PERFORM SOME VALIDATION
if any([EmailConfig.EMAIL_TO_ADDRESS in [None, ""],
Expand All @@ -41,6 +52,13 @@ def __init__(self):
f"{optional_variable_names}")
logger.error(error_message)
raise EnvironmentError(error_message)
# ATTEMPT AN EMAIL LOGIN AT INIT TO THROW ERRORS EARLY
_email_server = SMTP_SSL(EmailNotifications.email_smtp_server,
EmailNotifications.email_smtp_server_port)
_email_server.ehlo()
_email_server.login(user=EmailNotifications.email_username,
password=EmailNotifications._email_password)
_email_server.quit()

def __repr__(self):
return "<EmailNotifications>"
Expand All @@ -63,16 +81,16 @@ def send_message(message: str, **kwargs) -> object:
"""
email = EmailMessage()
email.set_content(message)
email["Subject"] = kwargs.get("subject", EmailConfig.EMAIL_SUBJECT_LINE)
email["From"] = kwargs.get("from", EmailConfig.EMAIL_FROM_ADDRESS)
email["To"] = kwargs.get("to", EmailConfig.EMAIL_TO_ADDRESS)
email_server_user = kwargs.get("username", EmailConfig.EMAIL_USERNAME)
email["Subject"] = kwargs.get("subject", EmailNotifications.email_subject)
email["From"] = kwargs.get("from", EmailNotifications.email_from)
email["To"] = kwargs.get("to", EmailNotifications.email_to)
email_server_user = kwargs.get("username", EmailNotifications.email_username)
email_server_password = kwargs.get("password",
EmailConfig.EMAIL_PASSWORD)
EmailNotifications._email_password)
email_server_smtp_server = kwargs.get("server",
EmailConfig.EMAIL_SMTP_SERVER)
EmailNotifications.email_smtp_server)
email_server_smtp_server_port = kwargs.get("port",
EmailConfig.EMAIL_SMTP_PORT)
EmailNotifications.email_smtp_server_port)
email_server = SMTP_SSL(email_server_smtp_server,
email_server_smtp_server_port)
email_server.ehlo()
Expand Down
1 change: 0 additions & 1 deletion camply/utils/camply_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def main():
logger.debug("Handling Exit Request")
finally:
logger.camply(CommandLineConfig.CAMPLY_EXIT_MESSAGE)
exit(0)


class CommandLineError(Exception):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "camply"
version = "0.1.1"
version = "0.1.2"
description = "camply, the campsite finder ⛺️"
authors = ["Justin Flannery <[email protected]>"]
maintainers = ["Justin Flannery <[email protected]>"]
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from setuptools import setup

from camply import __version__ as camply_version

packages = ["camply",
"camply.config",
"camply.notifications",
Expand All @@ -36,7 +38,7 @@

setup_kwargs = {
"name": "camply",
"version": "0.1.1",
"version": camply_version,
"description": "camply, the campsite finder",
"long_description": long_description,
"long_description_content_type": "text/markdown",
Expand Down

0 comments on commit 0dfeb24

Please sign in to comment.