Skip to content

Easier way to omit ssl verification#145

Merged
GrandMoff100 merged 6 commits into
HomeAssistant-API:devfrom
mietzen:dev
Mar 11, 2023
Merged

Easier way to omit ssl verification#145
GrandMoff100 merged 6 commits into
HomeAssistant-API:devfrom
mietzen:dev

Conversation

@mietzen
Copy link
Copy Markdown
Contributor

@mietzen mietzen commented Jan 22, 2023

You can now use:

with Client(hass_url, hass_token, verify_ssl=False) as client:

instead of:

with Client(hass_url, hass_token, global_request_kwargs={'verify': False}) as client:

@mietzen mietzen requested a review from GrandMoff100 as a code owner January 22, 2023 14:14
@GrandMoff100
Copy link
Copy Markdown
Collaborator

This is a cool idea! I'm interested in hearing more about the motivation for your idea and what your use case is like. Could you tell us more about that?

@mietzen
Copy link
Copy Markdown
Contributor Author

mietzen commented Jan 22, 2023

This is a cool idea! I'm interested in hearing more about the motivation for your idea and what your use case is like. Could you tell us more about that?

I wrote a Python module (fritz-advanced-thermostat) to control the offset of FRITZ!DECT30X Thermostats. The manufacture AVM is unfortunately unwilling to let us control the offset via the official API, so I'm using selenium + chromium to do so.
First I wanted to write a AppDeamon App, but spinning up a chromium instances is too much for my raspberry pi.

So now I'm using HomeAssistantAPI in combination with fritz-advanced-thermostat in a docker container on my NAS and since I'm running all my internal services on https I needed a way to disable ssl verification.

I thought adding the option in general would spare some one with a similar use case the hassle of digging through the source code.

@GrandMoff100
Copy link
Copy Markdown
Collaborator

Sounds awesome.

Copy link
Copy Markdown
Collaborator

@GrandMoff100 GrandMoff100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing Fixes

The verify parameter isn't accepted by the aiohttp.request method, which is why some of the tests are failing, as this default parameter value is being added to all async test requests. I'd propose we move the parameter to RawClient, the synchronous client that uses requests.

Styling Fixes

This part definitely isn't your fault but we just need to fix the type annotation for global_request_kwargs to dict[str, Any] | None in a few spots.

@GrandMoff100 GrandMoff100 self-requested a review January 23, 2023 15:32
@GrandMoff100 GrandMoff100 dismissed their stale review January 23, 2023 15:33

New commit. Fixed changes.

GrandMoff100
GrandMoff100 previously approved these changes Feb 3, 2023
@GrandMoff100
Copy link
Copy Markdown
Collaborator

@mietzen could you add me as a collaborator with push permissions on your form so I may polish this PR to pass quality checks?

@mietzen
Copy link
Copy Markdown
Contributor Author

mietzen commented Mar 11, 2023

Easier way to omit ssl verification by mietzen · Pull Request #145 · GrandMoff100HomeAssistantAPI

You should be good to go 👍
Sorry my time is quite limited lately, this PR went by the board.

@GrandMoff100
Copy link
Copy Markdown
Collaborator

No worries 👍 I got you.

@GrandMoff100
Copy link
Copy Markdown
Collaborator

Manually merging this because the tests pass on my machine. GitHub isn't passing the HOMEASSISTANTAPI_TOKEN secret from the environment to the workflow causing all of them to fail with an authentication error.

@GrandMoff100 GrandMoff100 merged commit 272b42f into HomeAssistant-API:dev Mar 11, 2023
@GrandMoff100 GrandMoff100 linked an issue Mar 11, 2023 that may be closed by this pull request
adamlogan73 pushed a commit that referenced this pull request Apr 3, 2026
Easier way to omit ssl verification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add possibility to bypass certificate verify

2 participants