mirror of
https://github.com/HuFlungDu/pylibmeshctrl.git
synced 2026-02-20 13:42:11 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0b89b89e6 | ||
|
|
fdc2b11afd | ||
|
|
4ed332ca4c | ||
|
|
5f0f6a0ff9 |
53
README.rst
53
README.rst
@@ -29,15 +29,60 @@
|
|||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
=============
|
|
||||||
meshctrl
|
meshctrl
|
||||||
=============
|
========
|
||||||
|
|
||||||
|
Library for remotely interacting with a
|
||||||
|
`MeshCentral <https://meshcentral.com/>`__ server instance
|
||||||
|
|
||||||
Libmeshctrl implementation in python
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
pip install meshctrl
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
This module is implemented as a primarily asynchronous library
|
||||||
|
(asyncio), mostly through the ``Session`` class, which is exported as
|
||||||
|
default. Because the library is asynchronous, you must wait for it to be
|
||||||
|
initialized before interacting with the server. The preferred way to do
|
||||||
|
this is to use the async context manager pattern:
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
import meshctrl
|
||||||
|
|
||||||
|
async with meshctrl.session.Session(url, **options):
|
||||||
|
print(await session.list_users())
|
||||||
|
...
|
||||||
|
|
||||||
|
However, if you prefer to instantiate the object yourself, you can
|
||||||
|
simply use the ``initialized`` property:
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
session = meshctrl.session.Session(url, **options)
|
||||||
|
await session.initialized.wait()
|
||||||
|
|
||||||
|
Note that, in this case, you will be rquired to clean up tho session
|
||||||
|
using its ``close`` method.
|
||||||
|
|
||||||
|
Session Parameters
|
||||||
|
------------------
|
||||||
|
|
||||||
|
``url``: URL of meshcentral server to connect to. Should start with
|
||||||
|
either "ws://" or "wss://".
|
||||||
|
|
||||||
|
``options``: optional parameters. Described at `Read the
|
||||||
|
Docs <https://pylibmeshctrl.readthedocs.io/en/latest/api/meshctrl.html#module-meshctrl.session>`__
|
||||||
|
|
||||||
|
API
|
||||||
|
---
|
||||||
|
|
||||||
|
API is documented in the `API
|
||||||
|
Docs <https://pylibmeshctrl.readthedocs.io/en/latest/api/meshctrl.html>`__
|
||||||
|
|
||||||
This is a library for interacting with a Mesh Central instance programatically. Written in python.
|
|
||||||
|
|
||||||
|
|
||||||
.. _pyscaffold-notes:
|
.. _pyscaffold-notes:
|
||||||
|
|||||||
@@ -36,14 +36,16 @@ package_dir =
|
|||||||
=src
|
=src
|
||||||
|
|
||||||
# Require a min/specific Python version (comma-separated conditions)
|
# Require a min/specific Python version (comma-separated conditions)
|
||||||
# python_requires = >=3.8
|
python_requires = >=3.8
|
||||||
|
|
||||||
# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
|
# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
|
||||||
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
|
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
|
||||||
# new major versions. This works if the required packages follow Semantic Versioning.
|
# new major versions. This works if the required packages follow Semantic Versioning.
|
||||||
# For more information, check out https://semver.org/.
|
# For more information, check out https://semver.org/.
|
||||||
install_requires =
|
install_requires =
|
||||||
importlib-metadata; python_version<"3.8"
|
importlib-metadata
|
||||||
|
cryptography>=43.0.3
|
||||||
|
websockets>=13.1
|
||||||
|
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Session(object):
|
|||||||
domain (str): Domain to connect to
|
domain (str): Domain to connect to
|
||||||
password (str): Password with which to connect. Can also be password generated from token.
|
password (str): Password with which to connect. Can also be password generated from token.
|
||||||
loginkey (str|bytes): Key from already handled login. Overrides username/password.
|
loginkey (str|bytes): Key from already handled login. Overrides username/password.
|
||||||
proxy (str): "url:port" to use for proxy server
|
proxy (str): "url:port" to use for proxy server NOTE: This is currently not implemented due to a limitation of the undersying websocket library. Upvote the issue if you find this important.
|
||||||
token (str): Login token. This appears to be superfluous
|
token (str): Login token. This appears to be superfluous
|
||||||
ignore_ssl (bool): Ignore SSL errors
|
ignore_ssl (bool): Ignore SSL errors
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user