Add missing ssl related arguments to Redis from_url method
solves #12149, the gist of which is:
- a Redis client (redis.Redis) can be obtained by using either its constructor, or
from_urlmethod - connection options can be specified as arguments to either
- some of those options (eg
ssl_ca_data) were missing as defined parameters forfrom_url - this caused mypy to give false positives those missing SSL options were specified as kwargs to
from_url
Change Details
To fix the issue, following 9 options were added as params to from_url
ssl_ca_pathssl_ca_datassl_passwordssl_validate_ocspssl_validate_ocsp_stapledssl_ocsp_contextssl_ocsp_expected_certredis_connect_funccredential_provider
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Thanks! This becomes a bit repetitive, maybe we should use Unpack[] with a TypedDict (PEP-692) to define these kwargs?
Thanks! This becomes a bit repetitive, maybe we should use Unpack[] with a TypedDict (PEP-692) to define these kwargs?
Good point - those (almost) identical parameters being repeated 5 times do seem a bit much.
However, as TypedDicts don't support default values for keys, it wouldn't be possible to define the parameter defaults. We could get around that by defining a dataclass, but I think that would quite an impact on existing code bases, having to switch from dict to class based syntax.