## Installation
You can install the LonaDB Python Client via pip:
```bash
pip install lonadb-client
```
## Usage
To use the `LonaDB` Python Client, follow these steps:
1. Import the `LonaDB` class into your Python script:
```python
from lonadb_client import LonaDB
```
2. Create an instance of the `LonaDB` class by providing the required connection details:
```python
client = LonaDB(host, port, name, password)
```
Replace `host`, `port`, `name`, and `password` with the appropriate values for your LonaDB server.
3. Use the provided methods to interact with the server:
```python
# Example: Get a list of tables
tables = client.get_tables("username");
# Display the list of tables
print(tables)
```
## Available Methods
### `get_tables(user)`
Retrieves a list of tables available in the database.
### `get_table_data(table)`
Retrieves data from a specified table.
### `delete_table(table)`
Deletes a table by its name.
### `create_table(table)`
Creates a new table with the given name.
### `set_variable(table, name, value)`
Sets a variable within a table to the specified value.
### `remove_variable(table, name)`
Deletes a variable from a table.
### `get_variable(table, name)`
Retrieves the value of a variable from a table.
### `get_users()`
Retrieves a list of users in the database.
### `create_user(name, password)`
Creates a new user with the given name and password.
### `delete_user(name)`
Deletes a user by their name.
### `check_password(name, password)`
Checks if the provided password is correct for a given user.
### `check_permission(name, permission)`
Checks if a user has a specific permission.
### `remove_permission(name, permission)`
Removes a permission from a user.
### `get_permissions_raw(name)`
Retrieves the raw permission data for a user.
### `add_permission(name, permission)`
Adds a permission to a user.
### `create_function(name, content)`
Create a function which can be executed whenever you want. Just like eval.
Content = string of PHP code
### `execute_function(name)`
Executes the function
### `eval(func)`
Runs the function (must be a string of PHP code)
Example: "if ($abc == 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).
Raw data
{
"_id": null,
"home_page": "https://github.com/LonaDB/Clients",
"name": "lonadb-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "lonadb client database",
"author": "Collin Buchkamer",
"author_email": "collin@lona-development.org",
"download_url": "https://files.pythonhosted.org/packages/97/80/5086c9c8bcef0f2b539268403232ae4ec42cbdcdd91fe1910eeaa35e3242/lonadb-client-2.2.tar.gz",
"platform": "any",
"description": "## Installation\n\nYou can install the LonaDB Python Client via pip:\n\n```bash\npip install lonadb-client\n```\n\n## Usage\n\nTo use the `LonaDB` Python Client, follow these steps:\n\n1. Import the `LonaDB` class into your Python script:\n\n```python\nfrom lonadb_client import LonaDB\n```\n\n2. Create an instance of the `LonaDB` class by providing the required connection details:\n\n```python\nclient = LonaDB(host, port, name, password)\n```\n\nReplace `host`, `port`, `name`, and `password` with the appropriate values for your LonaDB server.\n\n3. Use the provided methods to interact with the server:\n\n```python\n# Example: Get a list of tables\ntables = client.get_tables(\"username\");\n\n# Display the list of tables\nprint(tables)\n```\n\n## Available Methods\n\n### `get_tables(user)`\n\nRetrieves a list of tables available in the database.\n\n### `get_table_data(table)`\n\nRetrieves data from a specified table.\n\n### `delete_table(table)`\n\nDeletes a table by its name.\n\n### `create_table(table)`\n\nCreates a new table with the given name.\n\n### `set_variable(table, name, value)`\n\nSets a variable within a table to the specified value.\n\n### `remove_variable(table, name)`\n\nDeletes a variable from a table.\n\n### `get_variable(table, name)`\n\nRetrieves the value of a variable from a table.\n\n### `get_users()`\n\nRetrieves a list of users in the database.\n\n### `create_user(name, password)`\n\nCreates a new user with the given name and password.\n\n### `delete_user(name)`\n\nDeletes a user by their name.\n\n### `check_password(name, password)`\n\nChecks if the provided password is correct for a given user.\n\n### `check_permission(name, permission)`\n\nChecks if a user has a specific permission.\n\n### `remove_permission(name, permission)`\n\nRemoves a permission from a user.\n\n### `get_permissions_raw(name)`\n\nRetrieves the raw permission data for a user.\n\n### `add_permission(name, permission)`\n\nAdds a permission to a user.\n\n### `create_function(name, content)`\n\nCreate a function which can be executed whenever you want. Just like eval.\nContent = string of PHP code\n\n### `execute_function(name)`\n\nExecutes the function\n\n### `eval(func)`\n\nRuns the function (must be a string of PHP code)\nExample: \"if ($abc == 1234) return 'wtf';\"\nResponse: {\"success\": True, \"response\": \"wtf\", \"process\": processID}\n\n## License\n\nThis project is licensed under the GNU Affero General Public License version 3 (GNU AGPL-3.0).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A client library for interacting with LonaDB server",
"version": "2.2",
"project_urls": {
"Homepage": "https://github.com/LonaDB/Clients"
},
"split_keywords": [
"lonadb",
"client",
"database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "97805086c9c8bcef0f2b539268403232ae4ec42cbdcdd91fe1910eeaa35e3242",
"md5": "fbe8dcfdec41379035a9e58e11563921",
"sha256": "468c0dfc71cc771002ac2a8bdc1b2d8f9e86c780bfa551207443268e84799213"
},
"downloads": -1,
"filename": "lonadb-client-2.2.tar.gz",
"has_sig": false,
"md5_digest": "fbe8dcfdec41379035a9e58e11563921",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3478,
"upload_time": "2024-03-15T10:43:02",
"upload_time_iso_8601": "2024-03-15T10:43:02.571569Z",
"url": "https://files.pythonhosted.org/packages/97/80/5086c9c8bcef0f2b539268403232ae4ec42cbdcdd91fe1910eeaa35e3242/lonadb-client-2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-15 10:43:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LonaDB",
"github_project": "Clients",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "lonadb-client"
}