Skip to main content

LocalStore is a Python library that provides various operations on a local database of products, which can be used to store and manage information about items in a local store inventory and it also give mobility to create an local API for the database. Besides this it can convert CSV file to json.

Project description

localstore

The localstore package is a collection of Python modules for managing data in a local store. It includes modules for converting CSV files to a JSON dataset, managing data in a local JSON store, and creating a local API for accessing data in the store.

Installation

To install the localstore package, you can use pip:

pip install localstore

Usage

DatasetConverter

The DatasetConverter module provides a simple and intuitive API for converting CSV files to a JSON dataset. To use the DatasetConverter module, you can:

  1. Import the DatasetConverter module:
from localstore.DatasetConverter import Converter
  1. Create an instance of the Converter class:
converter = Converter()
  1. Convert all the CSV files in a specified directory to a JSON dataset:
converter.Dataset_From_Directory('path/to/directory')
  1. Convert a single CSV file to a JSON dataset:
converter.Dataset_From_File('path/to/file.csv')
  1. Create a JSON dataset file and a text file containing the length of the dataset:
converter.Create_Dataset()

LocalStore

The LocalStore module provides a simple and intuitive API for managing data in a local JSON store. To use the LocalStore module, you can:

  1. Import the LocalStore module:
from localstore.LocalStore import LocalStore
  1. Create an instance of the LocalStore class:
local_store = LocalStore()
  1. Add a new product to the local store:
product = {
    'name': 'iPhone 13 Pro',
    'main_category': 'Electronics',
    'sub_category': 'Smartphones',
    'image': 'https://example.com/iphone-13-pro.jpg',
    'link': 'https://example.com/iphone-13-pro',
    'ratings': '4.5',
    'no_of_ratings': '100',
    'discount_price': '999.00',
    'actual_price': '1099.00'
}
local_store.Add_New_Product(product_name='Apple', data=product)
  1. Get a list of all the products in the local store:
products = local_store.Show_product_List()
  1. Print the list of products:
for product in products:
    print(product)

LocalAPI

The LocalAPI module provides a simple and intuitive API for creating a local API for accessing data in the store. To use the LocalAPI module, you can:

  1. Import the LocalAPI module:
from localstore.LocalAPI import LocalAPI
  1. Create an instance of the LocalAPI class:
local_api = LocalAPI()
  1. Start the LocalAPI server:
local_api.runServer()
  1. Send API requests to the LocalAPI server to perform CRUD operations on data in the local store:
import requests

# Get a list of all the products in the local store
products = requests.get('http://localhost:5000/products/show/')

# Print the list of products
for product in products.json():
    print(product)

Conclusion

The localstore package is a powerful and easy-to-use Python package for managing data in a local store. It is a great choice for a variety of applications, including e-commerce websites, content management systems, data analysis applications, and any other application that needs to store data locally.

Contributing

Contributions to LocalStore are welcome! Please read the contributing guidelines before submitting a pull request.

License

LocalStore is licensed under the MIT License

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

localstore-0.2.0.tar.gz (283.0 kB view details)

Uploaded Source

Built Distribution

localstore-0.2.0-py3-none-any.whl (291.1 kB view details)

Uploaded Python 3

File details

Details for the file localstore-0.2.0.tar.gz.

File metadata

  • Download URL: localstore-0.2.0.tar.gz
  • Upload date:
  • Size: 283.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Windows/10

File hashes

Hashes for localstore-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e4f38c989ce548484a74bde4f4f0693239df5860aefe3b0cf003ef50af5878ab
MD5 313ea5f4a6fcbcf8b00f8357767b7fb0
BLAKE2b-256 180b691e28748dbf6b5b5905654f732522442255017bd4c7b3d2ba79c59dbfd3

See more details on using hashes here.

File details

Details for the file localstore-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: localstore-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 291.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Windows/10

File hashes

Hashes for localstore-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1815bb71b75fe4b9aa135fad7ed0943e87335b016b656ecfd3251fb64536a28
MD5 1e1180edf86d04eb4723bfa10adeab82
BLAKE2b-256 a3642dcb6cc5f32434e2383256e9b2a39899ebba9a13f1d4572f9ddc4f9d8ddf

See more details on using hashes here.

Supported by

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