Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Add skip verify cli flag #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

s00500
Copy link

@s00500 s00500 commented Oct 30, 2023

Adds --skipVerify CLI flag to work with self signed SSL certificates. Fixes #18

Signed-off-by: Lukas Bachschwell <[email protected]>
Signed-off-by: Lukas Bachschwell <[email protected]>
Signed-off-by: Lukas Bachschwell <[email protected]>
Signed-off-by: Lukas Bachschwell <[email protected]>
@@ -69,6 +69,7 @@ async def main() -> None:
choices=("http", "https"),
help="Home Assistant protocol",
)
parser.add_argument("--skipVerify", action="store_true", help="Skip verification of the SSL certificate")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
parser.add_argument("--skipVerify", action="store_true", help="Skip verification of the SSL certificate")
parser.add_argument("--skip-certificate-verification", action="store_true", help="Skip verification of the SSL certificate")

Existing arguments use lowercase and dashes in between words, so you should follow that. Even then skip-verify would be too generic IMO.

Copy link
Author

Choose a reason for hiding this comment

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

made it --skip-verify. you you really want it to extend ? There is not really another thing to confuse it with, apart from that it has a help text

@@ -235,6 +236,7 @@ async def main() -> None:
host=args.host,
protocol=args.protocol,
port=args.port,
skipVerify=args.skipVerify,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
skipVerify=args.skipVerify,
skipVerify=args.skipVerify,

Python generally uses snake case, not camel case.

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 41 to 42
if skipVerify:
self._session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False))
else:
self._session = aiohttp.ClientSession()

self._session = aiohttp.ClientSession()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you always pass the negated value to the TCPConnector here?

Copy link
Author

Choose a reason for hiding this comment

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

done

- snake case
- inversion for passing arg to clientconnection

Signed-off-by: Lukas Bachschwell <[email protected]>
@s00500
Copy link
Author

s00500 commented Nov 15, 2023

Anything else needed here ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certificate issues with aiohttp
2 participants