jplana / python-etcd

A python client for etcd
Other
523 stars 210 forks source link

key names are not transparently URL encoded #178

Closed dannysauer closed 8 years ago

dannysauer commented 8 years ago

As it turns out, key names are not being escaped to make them URL-safe before being inserted. While etcd can support a key name of "#" or ";", the module fails when trying to create those. There are two possible solutions. One is for the module to automagically encode them. The other is to document that the end-user should quote their keys if they're using anything outside of the ASCII digits-and-letters range. It seems like being transparent about encoding the keys would be preferable.

I've worked around this in my script by doing this. I'd be happy if a future update broke my code, though. :)

k = urllib.quote( ''.join(s))
client.write( posixpath.join(prefix, k), '' )
lavagetto commented 8 years ago

@dannysauer no I don't think I will magically quote keys for users without them knowing, if you want to use "special" chars in key names it is your responsibility to encode them.

A documentation PR would be very welcome obviously :)