Skip to main content

BSON codec for Python

Project description

https://img.shields.io/pypi/v/bson.svg https://img.shields.io/travis/py-bson/bson.svg https://img.shields.io/pypi/pyversions/bson.svg

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bson_senao-0.5.10.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bson_senao-0.5.10-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file bson_senao-0.5.10.tar.gz.

File metadata

  • Download URL: bson_senao-0.5.10.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bson_senao-0.5.10.tar.gz
Algorithm Hash digest
SHA256 d546981430a0db98b59a354739cc677253d5ed44c26a4975a7ccb32e39899362
MD5 11a7141dc9e7d6b5d0c6c7c9e367d31d
BLAKE2b-256 e25b7bb0ed9329938ba3d40c80b3f08f2ec53c7c1f01565a0fd3b300f9674d87

See more details on using hashes here.

File details

Details for the file bson_senao-0.5.10-py3-none-any.whl.

File metadata

  • Download URL: bson_senao-0.5.10-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bson_senao-0.5.10-py3-none-any.whl
Algorithm Hash digest
SHA256 cbee3092a4d1263a172f3800d3eeab0d696678c08ec3c494a31070950a4c5deb
MD5 3d07ffe98c6387614de896cd0d2f90d9
BLAKE2b-256 8248b551e8987a41a8ccf23a3ce477f4dd5c4f09881bec0b775ceb3327ade4c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page