python-etcd3 icon indicating copy to clipboard operation
python-etcd3 copied to clipboard

the "filters" paramter of add watch function cannot be assigment

Open hqsh opened this issue 3 years ago • 1 comments

hello,

i want to add watch which only watch the put event of a key.

but i got the exception: AttributeError: Assigment not allowed to repeated field "filters" in protocal message object.

than i found the code in "etcd3/watch.py" line 62 & 63 is: if filters is not None: create_watch.filters = filters

i wonder whether the code should be: if filters is not None: for filter in filters: # filters is [0] or [1] or [0, 1] create_watch.filters.append(filter)

or, may be there is other method to assigment the value to the "filters". could you show me?

thank you!

hqsh avatar Jul 03 '21 01:07 hqsh

i found the code in github is correct.

if​ ​filters​ ​is​ ​not​ ​None​: create_watch​.​filters​.​extend​(​filters)

but the code downloaded by "pip install etcd3" is not correct.

hqsh avatar Jul 03 '21 01:07 hqsh