Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 1.01 KB

README.md

File metadata and controls

38 lines (25 loc) · 1.01 KB

zkpy

zkpy is a wrapper around Zookeeper's Python library, that should provide

Short example:

from __future__ import with_statement
from zkpy.acl import Acls
from zkpy.connection import zkopen, KeeperState, EventType, NodeCreationMode

# define a watcher function
def global_watcher(type, state, path):
    print 'GLOBAL: event=%s, state=%s, path=%s' % (EventType[type], KeeperState[state], path)
    
with zkopen('localhost:2181', 5) as conn:
    # add a connection watcher for fun
    conn.add_global_watcher(global_watcher)
    
    # create a node
    conn.create('/bar','', [Acls.Unsafe], NodeCreationMode.Ephemeral)
    print conn.get_children('/')

Todo:

  • Better zookeeper wrapping (Exceptions, return codes)
  • More recipes
  • Tests
  • Documentation