Skip to content

py-bson/bson

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Use assertEqual instead of assertEquals for Python 3.11 compatibility.
7a9174c

Git stats

Files

Permalink
Failed to load latest commit information.

bson

Independent BSON codec for Python that doesn't depend on MongoDB. The bson ObjectId implementation is forked from the PyMongo project, licensed under the Version 2.0 Apache License.

Installation

~ $ python setup.py install

or can use pip

~ $ pip install bson

Quick start

>>> 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'}]}

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!"})

About

Independent BSON codec for Python that doesn't depend on MongoDB.

Resources

License

Unknown, Apache-2.0 licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE_APACHE

Stars

Watchers

Forks

Packages

No packages published

Languages