Skip to main content

Dict with json file saving / restoring support

Project description

Dict with json file saving / restoring support

  • datetime, date support

  • readable formated json

  • safely file write with file move os function

  • auto-save support

  • compression support

Install

pip install jsondict

Usage

>>> from datetime import datetime
>>> from jsondict import JsonDict
>>> db = JsonDict('var/test.json')
>>> db.clear()
>>> db.update({'b': 2, 'created': datetime(2013, 1, 27, 21, 14), 'a': 1})
>>> db.save()
>>> open(db.filename).read()
'{\n  "a": 1,\n  "b": 2,\n  "created": "2013-01-27T21:14:00Z"\n}'

Auto-save and compression

>>> import gzip
>>> db = JsonDict('var/test.json.gz', compress=True, autosave=True)
>>> db.clear()
>>> db['x'] = 'y'
>>> gzip.open(db.filename).read()
'{\n  "x": "y"\n}'

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

jsondict-1.1.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file jsondict-1.1.tar.gz.

File metadata

  • Download URL: jsondict-1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jsondict-1.1.tar.gz
Algorithm Hash digest
SHA256 b1fe16ec2e4b8bb6bae7349a2248900f9160a98f366f846bf2b823d248b82d9b
MD5 07ec29b11f32cd0dfec3edd0a5decaef
BLAKE2b-256 24abf2d0f76d366f4c0fdc139dc8f1db190481c1a82d8b9d759b0d3cd83d86f4

See more details on using hashes here.

Supported by

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