A client library for interacting with LonaDB server
Project description
lonadb-client
The Lonadb Client is a Python library designed to simplify communication with the LonaDB database server. This library provides an easy way to interact with the server's various functions, allowing you to manage tables, variables, users, permissions, and more. It streamlines the process of sending requests and receiving responses from the server using the TCP protocol.
Installation
You can install the Lonadb Client library using pip:
pip install lonadb-client
Usage
To use the lonadb-client
library, follow these steps:
- Import the required modules and classes:
from lonadb_client import LonadbClient
- Create an instance of the
LonaDB-Client
class:
client = LonaClient(host, port, name, password)
Replace host
, port
, name
, and password
with the appropriate values for your Lonadb database server.
- Use the provided methods to interact with the server:
# Example: Get a list of tables
tables = await client.getTables()
print("Available tables:", tables)
Available Methods
getTables()
Retrieves a list of tables available in the database.
getTableData(table)
Retrieves data from a specified table.
deleteTable(table)
Deletes a table by its name.
createTable(table)
Creates a new table with the given name.
set(table, name, value)
Sets a variable within a table to the specified value.
delete(table, name)
Deletes a variable from a table.
get(table, name)
Retrieves the value of a variable from a table.
getUsers()
Retrieves a list of users in the database.
createUser(name, password)
Creates a new user with the given name and password.
deleteUser(name)
Deletes a user by their name.
checkPassword(name, password)
Checks if the provided password is correct for a given user.
checkPermission(name, permission)
Checks if a user has a specific permission.
removePermission(name, permission)
Removes a permission from a user.
getPermissionsRaw(name)
Retrieves the raw permission data for a user.
addPermission(name, permission)
Adds a permission to a user.
eval(function)
Runs the function. (must be a string)
Example: "if(lona.config.port === 1234) return 'wtf'"
Response: {"success": true, "response": "wtf", "process": processID}
License
This project is licensed under the GNU Affero General Public License version 3 (GNU AGPL-3.0)
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
Built Distribution
File details
Details for the file lonadb-client-1.3.tar.gz
.
File metadata
- Download URL: lonadb-client-1.3.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a5fd3f47729d0a93ae268331c64f25b6224f6898415fa183b2b0874ad48ad69 |
|
MD5 | d1719ea213699005fc9b0229fa9d334a |
|
BLAKE2b-256 | 254f5b2adb7c78934dfd46b3a9b5d983458d4da4d982c07119900763b36b828f |
File details
Details for the file lonadb_client-1.3-py3-none-any.whl
.
File metadata
- Download URL: lonadb_client-1.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd619c9fe1fd823a2e0fb406e25019f68707f1105284324497941b15f3cd5c12 |
|
MD5 | 86a2eaa96e9c19c1609037bc4feffc30 |
|
BLAKE2b-256 | a16abc3be7801cae361efc49c4abf2df712efe232cc90eeaf08cddf34b1568fb |