forked from py-bson/bson
-
Notifications
You must be signed in to change notification settings - Fork 0
Independent BSON codec for Python that doesn't depend on MongoDB.
License
jchia/bson
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
TO USE: >> import bson >>> a = bson.dumps({"A":[1,2,3,4,5,"6", u"7", {"C":u"DS"}]}) >>> b = bson.loads(a) >>> b {'A': [1, 2, 3, 4, 5, '6', u'7', {'C': u'DS'}]} Currently, bson.dumps() and bson.loads() expects everything to be documents, or dicts in Python-speak. Another use case is sending and receiving BSON objects to and from network sockets. >>> from gevent import monkey, socket; monkey.patch_all() >>> import bson; bson.patch_socket() >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>> s.connect(("127.0.0.1", 12345)) >>> s.sendobj({u"message" : "hello!"}) All the bson networking functions are coded with coroutine based I/O in mind so it's highly recommended to use it with a coroutine I/O library like gevent or eventlet. Utilizing bson networking functions without properly patching in coroutine I/O logic will likely lead to extremely poor performance. TO INSTALL: If you want to try out the source package, you do this... $ ./setup.py build $ sudo ./setup.py install Or, you can simply do this instead... $ sudo easy_install bson
About
Independent BSON codec for Python that doesn't depend on MongoDB.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%