juftin / camply

camply, the campsite finder ⛺️ - a tool to find campsites at sold out campgrounds through sites like recreation.gov
https://juftin.com/camply/
MIT License
486 stars 94 forks source link

Webhook crashes on utf-8 characters #302

Closed zdwolfe closed 1 year ago

zdwolfe commented 1 year ago

Describe the bug

Campsite messages with UTF-8 characters cannot be parsed by the webhook notification handler.

Original Camply Command (with --debug)

 WEBHOOK_URL="http://localhost:8000" camply campsites --campground 233998 --start-date 2023-10-10 --end-date 2023-10-21  --notifications webhook

Crashes with

RuntimeError: camply encountered an error and exited 😟 [2023-09-14 22:13:53] - (UnicodeEncodeError) 'latin-1' codec
can't encode character '\U0001f3d5' in position 161: Body ('πŸ•') is not valid Latin-1. Use body.encode('utf-8') if you
want to send it encoded in UTF-8.

Expected behavior

A notification of form


{"campsites": [{"campsite_id": 76540, "booking_date": "2023-10-12T00:00:0

Additional context

I opened a PR for a fix a few days ago, https://github.com/juftin/camply/pull/299 , but opening an issue to track the actual bug.

juftin commented 1 year ago

:tada: This issue has been resolved in version 0.31.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: