synack / ncore
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (2)
- Wiki (1)
- Graphs
-
Branch:
debian
Jeremy Grosser (author)
Tue Oct 20 12:11:45 -0700 2009
ncore /
README
ncore contains a number of utility modules for neohippie.net applications
daemon.py
This module performs the common task of daemonizing a process by forking it and
separating it from the current session.
>> from ncore.daemon import become_daemon
>> become_daemon()
rest.py
Implements some convenience methods for working with RESTful services
>> from ncore.rest import request
>> status, headers, response = request('GET', 'http://twitter.com/statuses/public_timeline.json')
>> status
200
serialize.py
For use with WebOb, allow serialization of multiple formats for use in HTTP
responses.
>>> from ncore.serialize import dumps, loads
>>> from webob import Request
>>> r = Request({'QUERY_STRING': 'format=json&callback=cbfunc1'})
>>> dumps(r.params, {'a': 1, 'b': 2, 'c': 3})
'cbfunc1({\n "a": 1, \n "c": 3, \n "b": 2\n})'
>>> r = Request({'QUERY_STRING': 'format=yaml'})
>>> dumps(r.params, {'a': 1, 'b': 2, 'c': 3})
'{a: 1, b: 2, c: 3}\n'
xml.py
Build XML trees in a fairly pythonic way.
>>> from ncore.xml import XMLBuilder
>>> root = XMLBuilder()
>>> root.foo.bar = 'Hello world'
>>> root.foo['id'] = 20
>>> root.baz = 'gir'
>>> print str(root)
<foo><bar id="20">Hello world</bar></foo><baz>gir</baz>

