franc6 / ics_calendar

Provides an ICS (icalendar) platform for the Home Assistant calendar
Apache License 2.0
128 stars 19 forks source link

change 'Accept' header #100

Closed FelixMarschall closed 9 months ago

FelixMarschall commented 10 months ago

change 'Accept' header

Fixes #

Description of change:

This pull request addresses an enhancement that allows our application to connect with platforms, e.g. anny.co, and start the download without a 'Permission denied' Error. To achieve this, I have added an "Accept" header to our HTTP requests, ensuring compatibility with the platform.

Formatting, testing, and code coverage

Please note your pull request won't be accepted if you haven't properly formatted your source code, and ensured the unit tests are appropriate. Please note if you are not running on Windows, you can either run the scripts via a bash installation (like git-bash).

franc6 commented 9 months ago

That accept header indicates a very badly misconfigured server (or proxy in front of the server). ICS data should have a MIME type of text/calendar, and the python library is either setting an accept header of "/", which means accept any MIME type, or it's not setting one at all, which indicates the same thing (unless there's a proxy server in between, in which case, it might need an explicit accept header of "/"). It's hard to follow the defect entries for python to determine which it's doing, and I don't feel like reading the python code myself. :)

Either way, this PR, setting an Accept header that doesn't include text/calendar is a bad idea. I'm releasing v3.2.0 which will let you configure a custom Accept header to address your problem.

Thanks for the report!