2017-06-09 15:21:19 +00:00
Server
======
2017-04-07 12:19:08 +00:00
2017-04-10 18:04:36 +00:00
The senpy server is launched via the `senpy` command:
2017-04-07 12:19:08 +00:00
2017-06-09 15:21:19 +00:00
.. code :: text
2017-04-07 12:19:08 +00:00
2019-01-07 11:08:19 +00:00
usage: senpy [-h] [--level logging_level] [--log-format log_format] [--debug]
[--no-default-plugins] [--host HOST] [--port PORT]
[--plugins-folder PLUGINS_FOLDER] [--only-install] [--only-test]
[--test] [--only-list] [--data-folder DATA_FOLDER]
[--no-threaded] [--no-deps] [--version] [--allow-fail]
2017-04-07 12:19:08 +00:00
2017-04-10 18:04:36 +00:00
Run a Senpy server
optional arguments:
2018-01-03 08:39:30 +00:00
-h, --help show this help message and exit
--level logging_level, -l logging_level
2017-04-10 18:04:36 +00:00
Logging level
2019-01-07 11:08:19 +00:00
--log-format log_format
Logging format
2018-01-03 08:39:30 +00:00
--debug, -d Run the application in debug mode
2019-01-07 11:08:19 +00:00
--no-default-plugins Do not load the default plugins
2018-01-03 08:39:30 +00:00
--host HOST Use 0.0.0.0 to accept requests from any host.
--port PORT, -p PORT Port to listen on.
--plugins-folder PLUGINS_FOLDER, -f PLUGINS_FOLDER
2017-04-10 18:04:36 +00:00
Where to look for plugins.
2018-01-03 08:39:30 +00:00
--only-install, -i Do not run a server, only install plugin dependencies
2019-01-07 11:08:19 +00:00
--only-test Do not run a server, just test all plugins
--test, -t Test all plugins before launching the server
2018-01-03 08:39:30 +00:00
--only-list, --list Do not run a server, only list plugins found
--data-folder DATA_FOLDER, --data DATA_FOLDER
Where to look for data. It be set with the SENPY_DATA
environment variable as well.
2019-01-07 11:08:19 +00:00
--no-threaded Run the server without threading
--no-deps, -n Skip installing dependencies
2018-01-03 08:39:30 +00:00
--version, -v Output the senpy version and exit
2019-01-07 11:08:19 +00:00
--allow-fail, --fail Do not exit if some plugins fail to activate
2017-04-10 18:04:36 +00:00
When launched, the server will recursively look for plugins in the specified plugins folder (the current working directory by default).
2017-06-09 15:21:19 +00:00
For every plugin found, it will download its dependencies, and try to activate it.
2017-04-10 18:04:36 +00:00
The default server includes a playground and an endpoint with all plugins found.
2017-06-09 15:21:19 +00:00
Let's run senpy with the default plugins:
.. code :: bash
2019-01-07 11:08:19 +00:00
senpy -f .
2017-06-09 15:21:19 +00:00
2019-01-07 11:08:19 +00:00
Now open your browser and go to `http://localhost:5000 <http://localhost:5000> `_ , where you should be greeted by the senpy playground:
2017-06-09 15:21:19 +00:00
.. image :: senpy-playground.png
:width: 100%
:alt: Playground
The playground is a user-friendly way to test your plugins, but you can always use the service directly: `http://localhost:5000/api?input=hello <http://localhost:5000/api?input=hello> `_ .
2019-01-07 11:08:19 +00:00
By default, senpy will listen only on `127.0.0.1` .
That means you can only access the API from your PC (i.e. localhost).
You can listen on a different address using the `--host` flag (e.g., 0.0.0.0, to allow any computer to access it).
2017-04-10 18:04:36 +00:00
The default port is 5000.
2017-06-09 15:21:19 +00:00
You can change it with the `--port` flag.
2017-04-10 18:04:36 +00:00
For instance, to accept connections on port 6000 on any interface:
.. code :: bash
senpy --host 0.0.0.0 --port 6000
For more options, see the `--help` page.