The JSONexusSync Python client library provides an easy-to-use interface for interacting with JSONexusSync remote database system using WebSockets.
Installation
You can install the JSONexusSync Python client library using pip:
pipinstalljsonexussync-client
Usage
Here's an example of how to use the JSONexusSync-client library:
import asyncioimport jsonfrom jsonexussync_client import JSONexusSyncClientasyncdefmain(): config ={"api_key":"YourApiKey","server_uri":"ws://localhost:8765"} client =JSONexusSyncClient(config)# Insert a new item into the 'users' collectionawait client.insert_data('users', {'name': 'Charlie', 'age': 35, 'email': 'charlie@example.com'})# Find users with a specific query result =await client.find_data('users', {'age': {'_op': '$eq', '_value': 35}})print(result)# Delete users with a specific queryawait client.delete_data('users', {'name': {'_op': '$eq', '_value': "Melissa Villarreal"}})# Update users with a specific query result =await client.update_data('users', {"age": {'_op': '$eq', '_value': 23}}, {"job": "Ethical Hacker"})# Creating a new database result =await client.create_db('my_app')# Generate an API key result =await client.generate_api_key('admin', 'my_app')# Gell all Databases Name result =await client.get_dbs()print(result) result =await client.create_collection("students")print(result)if__name__=="__main__": asyncio.run(main())
Conclusion
The JSONexusSync Python client library simplifies interaction with JSONexusSync remote database system, allowing developers to easily integrate real-time data synchronization into their Python applications.