Skip to main content

Build Status License PyPI version Codacy Badge Codacy Badge Documentation Status

json-storage-manager

json-storage-manager is a Python Package that simply manages the JSON files with the stored data of products and orders for a demo store API.

Installation

pip install json-storage-manager

atomic

Usage

atomic is basically used as a custom context manager for writing JSON files without downtime for the original file. It simply loads the JSON file into memory and opens a temporary file using the tempfile Python Package, finally once the operation is finished it performs an os.replace() to replace the original file (which is an atomic operation on Linux systems).

from json_storage_manager import atomic

with atomic.atomic_write(str(json_file)) as temp_file:
        with open(str(json_file)) as products_file:
            # get the JSON data into memory
            products_data = json.load(products_file)
        # now process the JSON data
        products_data.append(
            {'uuid': "2299d69e-deba-11e8-bded-680715cce955",
             'special_price': 111.0,
             'name': "Test Product"
             })
        json.dump(products_data, temp_file)

Metadata

Release files for json-storage-manager 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-storage-manager 0.1.12
File Size Uploaded
json_storage_manager-0.1.12.tar.gz 2.8 kB Details

Release files / json_storage_manager-0.1.12.tar.gz

Download URL json_storage_manager-0.1.12.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fee80b8b81f1e735590fe58b373fc0c12e3b889f8798a415862cf8549dc48461
BLAKE2b-256 checksum
How to use checksums
18a4866a41592bb6d9f7e2c5ed42ee049b675074ae97a6faadac1fc93f0407b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.1.12 This release

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

2 release files

0.1.7

1 release file

0.1.6

1 release file

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page