-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various items missing from redis client's from_url kwargs #12149
Comments
Please note that your example won't work at runtime (using redis 4.6.0): import redis
r = redis.Redis.from_url(
url="redis://",
health_check_interval=3,
ssl_ca_data="aaa",
)
r.get("aa")
The additional kwargs are passed to the |
@srittau my apologies, my excerpt didn't reflect the connection url's schema (now changed). In the case that the So admittedly |
Ah, that makes sense. So we should probably add the arguments to |
I'll give the PR a go! |
To get an instance of the redis client (redis.Redis), you can either call the constructor (docs) directly, or use the
from_url
method.In both cases you can specify options using kwargs, but a few of the kwargs are missing from the stub for
from_url
. This results in mypy (v1.10.0) giving an error when you use one of those kwargs - for examplessl_ca_data
like so:(Using any of the kwargs defined in the stub for
from_url
is ok)At runtime, specifying ssl_ca_data to
from_url
works fine, so its a false positive in mypy caused by the inaccurate stub as far as I can tell. Also from examining the insides offrom_url
, ssl_ca_data does seem to be a valid kwarg to give it.From the discussion at #10592 I'm aware that the typing for redis is incomplete and a bit up in the air in general, but this seems like a relatively easy thing to fix.
environment information
python version: 3.11.0
redis version: 4.4.0
types-redis version: 4.5.4.1
edited
corrected
url
arg in code excerpt to reflect ssl schema (ie, start with 'redis://').(This results in the
connection_pool.connection_class
in theRedis
object being set asSSLConnection
- a class which hasssl_ca_data
defined as constructor kwarg - so in this case passingssl_ca_data
toRedis.from_url
is meaningful.)The text was updated successfully, but these errors were encountered: