Pedal Pi - WebService
Pedal Pi - WebService is a Pedal Pi component that offers a Pedal Pi management over REST + WebSocket.
WebService also supports auto discover: by publishing to the network using zeroconf, it offers a certain level of location transparency, allowing applications to connect to the WebService with minimal user effort.
- Documentation:
- Code:
- Python Package Index:
- License:
Use
Installation and dependencies
Most dependencies will be installed through pip
pip install PedalPi-WebService
WebService, for its publication in the network for auto discover, needs the installation of pybonjour-python3. On debian/ubuntu-based systems, run:
sudo apt-get install libavahi-compat-libdnssd1
pip3 install git+https://github.com/depl0y/pybonjour-python3
Configuring the component
PedalPi components enable the extension of Pedal Pi - Application. Through them, opening services are offered. A list of components can be found in the Components repository.
To use this component, two steps are required:
1. Registering the webservice in Application
The registration must occur before application initialization (application.start)
from application.application import Application
application = Application(path_data="data/", address='localhost')
from webservice.webservice import WebService
application.register(WebService(application, port))
2. Initialization of the web server
The Application documentation suggests using signal.pause so that the program does not terminate at the end of initialization: signal.pause causes the program to be terminated only when it is requested (Ctrl + C).
When we use PedalPi-WebService, we must replace the use of signal.pause by initializing the web server. This is done using the following lines of code:
application.start()
import tornado
try:
tornado.ioloop.IOLoop.current().start()
except KeyboardInterrupt:
application.stop()
# Not more necessary
#from signal import pause
#try:
# pause()
#except KeyboardInterrupt:
# application.stop()
Config file
The code for starting the Application using the WebService component look like the following code:
from application.application import Application
application = Application(path_data="data/", address='localhost')
from webservice.webservice import WebService
application.register(WebService(application, port))
application.start()
import tornado
tornado.ioloop.IOLoop.current().start()
API
Rest
API documentation can be found at http://pedalpi.github.io/WebService/
WebSocket
Communication via WebService basically consists of receiving updates about the state of the application.
WebService API documentation can be found at http://pedalpi.github.io/WebService/#websocket
Using in your client
WebService disposes the Application features in a web service. These projects uses it for control:
Apk: App controller for smart devices and navigators.
If you are using too, please, send a pull request for this project.
Maintenance
Documentation
# Installing dependencies
npm install -g aglio
# Generate doc
cd docs/
aglio -i documentation.apib --theme-variables streak --theme-template triple -o index.html
# View documentation
firefox index.html
Test
# if number != 0 error
sh -c 'coverage3 run --source=webservice wstest/config.py test'; echo $?
coverage3 run --source=webservice wstest/config.py test
coverage3 report
coverage3 html
firefox htmlcov/index.html
Metadata
Release files for PedalPi-WebService 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PedalPi-WebService-0.3.0.tar.gz | 17.4 kB | Without provenance | Details for PedalPi-WebService-0.3.0.tar.gz |
Release files / PedalPi-WebService-0.3.0.tar.gz
| Download URL | PedalPi-WebService-0.3.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
edd584a0c01812622c2128d10a545bea18fe13eb7dbd89813db3623697b2a3a3
|
|
BLAKE2b-256 checksum How to use checksums |
0216c456eb372e748f1111872ad1b4fe1868e479cb036336bf781e563ecddad4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for PedalPi-WebService 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.