python package for XPARO
=========================
X.P.A.R.O is an innovative platform designed to provide remote management and control for various projects.
Website: `https://xparo-website.onrender.com `_
GitHub Repository: `https://github.com/lazyxcientist/xparo_remote `_
Contact: xpassistantpersonal@gmail.com
Requirements: ``websocket_client``
Getting Started with X.P.A.R.O
------------------------------
Follow these steps to use X.P.A.R.O effectively:
1. Visit the `Dashboard `_ and create a new project by clicking on the "Add New" button.
2. Go to your newly created project.
3. Copy the ``project_id`` (or ``secret_key`` if any) of your project.
4. Copy the API code provided below and paste your keys there.
5. To add a remote, hover over the menu at the top corner and navigate to the control icon.
6. Choose any custom remote or create a new remote.
Using the API
-------------
Basic Setup
^^^^^^^^^^^
.. code-block:: python
from xparo import Project
xp = Project("email", "project_id", "secret_key_if_any")
Remote Controller
^^^^^^^^^^^^^^^^^
Every time you use the remote, the following function will be called:
.. code-block:: python
from xparo import Project
xp = Project("email", "project_id", "secret_key_if_any")
# This function is called when new data is received from the remote
def remote_callback(command, remote_id):
print(command)
xp.remote_callback = remote_callback
# To send a custom remote command or use it as a remote
# Type 1: Send a remote command
xp.send("command")
# Type 2: Send a remote command with a unique remote ID
xp.send("command", "remote_id")
Sending Custom Errors
^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from xparo import Project
xp = Project("email", "project_id", "secret_key_if_any")
# Send an error command
xp.send_error("error")
# Type 2: Send an error command with a type of error
xp.send_error("error", "error type")
# Basic errors are sent automatically
Config Management
^^^^^^^^^^^^^^^^^
X.P.A.R.O allows you to manage your configuration while your project is deployed.
Change configurations at your `Dashboard `_.
.. code-block:: python
from xparo import Project
import os
xp = Project("email", "project_id", "secret_key_if_any")
# Set the config JSON file path
xp.config_path = os.path.join(os.path.dirname(__file__), 'config.json')
# This returns a dict of config
print(xp.config)
# Update or add the configuration globally
xp.update_config("key", "value")
# Add a callback to handle config changes
def config_changed(key, val):
print(key, val)
xp.config_callback = config_changed
.. raw:: html
.. raw:: html
.. raw:: html