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:
- Import the
DatasetConvertermodule:
from localstore.DatasetConverter import Converter
- Create an instance of the
Converterclass:
converter = Converter()
- Convert all the CSV files in a specified directory to a JSON dataset:
converter.Dataset_From_Directory('path/to/directory')
- Convert a single CSV file to a JSON dataset:
converter.Dataset_From_File('path/to/file.csv')
- 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:
- Import the
LocalStoremodule:
from localstore.LocalStore import LocalStore
- Create an instance of the
LocalStoreclass:
local_store = LocalStore()
- 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)
- Get a list of all the products in the local store:
products = local_store.Show_product_List()
- 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:
- Import the
LocalAPImodule:
from localstore.LocalAPI import LocalAPI
- Create an instance of the
LocalAPIclass:
local_api = LocalAPI()
- Start the LocalAPI server:
local_api.runServer()
- 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
Metadata
Release files for localstore 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| localstore-0.2.1.tar.gz | 3.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| localstore-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 MB
Release files / localstore-0.2.1.tar.gz
| Download URL | localstore-0.2.1.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17d07c26a082f924efac48e2cbed046e22cd0c7a68b83bd2c7264ec15b112d5e
|
|
BLAKE2b-256 checksum How to use checksums |
3cbe49282773a803f7c8af8cad14e446ff3d0ba7d143223a8d4a19e738603c7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.11 Windows/10
|
Release files / localstore-0.2.1-py3-none-any.whl
| Download URL | localstore-0.2.1-py3-none-any.whl |
|---|---|
| Size | 3.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ec718eb2ed59dc32626ed51c497302031607ab2bfda300452f5374453e20665
|
|
BLAKE2b-256 checksum How to use checksums |
149d2117530bbc8e9d5b4fa82f5612db25de625d5f54698ae28559bb8d325df1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.11 Windows/10
|