#! /usr/bin/env python from pygraylog.server import Server from pygraylog.users import User import json server = Server('dappmetlogapp1.pgs', 8080, False, False) server.auth_by_auth_basic('', '') users = server.get_users() john = User(server) user = { u'username' : u'john', u'full_name' : u'john doe', u'email' : '*****@*****.**', u'password' : u'secret', u'permissions' : [ ] } print user if john.find_by_id('john') == True: print 'john found' john.load_from_server('john') if john.update({ 'full_name' : 'John DOE' }) == True: print 'john updated' else: print 'john not updated' print john_response if john.delete() == True: print 'john deleted' else:
#! /usr/bin/env python from pygraylog.server import Server from pygraylog.users import User import json server = Server('dappmetlogapp1.pgs', 8080, False, False) server.auth_by_auth_basic('', '') users = server.get_users() john = User(server) user = { u'username': u'john', u'full_name': u'john doe', u'email': '*****@*****.**', u'password': u'secret', u'permissions': [] } print user if john.find_by_id('john') == True: print 'john found' john.load_from_server('john') if john.update({'full_name': 'John DOE'}) == True: print 'john updated' else:
#! /usr/bin/env python from pygraylog.server import Server from pygraylog.users import User import json server = Server("localhost", 12900, False, False) server.auth_by_auth_basic("foo", "bar") users = server.get_users() john = User(server) user = { u"username": u"john", u"full_name": u"john doe", u"email": "*****@*****.**", u"password": u"secret", u"permissions": [], } print user if john.find_by_id("john") == True: print "john found" john.load_from_server("john") if john.update({"full_name": "John DOE"}) == True: print "john updated" else:
#! /usr/bin/env python from pygraylog.users import User john = User('dappsyslogapp1.pgs', 12900, 'dieux', 'admin') #if john.find_by_username('mathieu.grzybek') == True: #print 'mathieu found' #if john.find_by_username('john') == True: #print 'john found' #else: #print 'john not found' user = { u'username' : u'john', u'full_name' : u'john doe', u'email' : '*****@*****.**', u'password' : u'doejohn', u'permissions' : [ u'*' ] } if john.find_by_id('john') == True: print 'john found' john._data['username'] = '******' if john.delete() == True: print 'john deleted' else: print 'john still exists' print john._response else: print 'john not found' if john.create(user) == True: print 'john created' print john._data else: print 'john failed'