Posts Tagged ‘python’
enabling and disabling a systemd service in Python using DBus
The upcoming picockpit-client reacts to deletion events from the frontend by disabling it’s service (the application will stay installed, however). Similarly, when you decide to run picockpit-client connect again, the service will be re-enabled and started automatically for you. This is possible using the Python DBus interface. the DBus is a bus system for interacting…
Weiterlesensecure command execution with Python: subprocess.Popen
Security is important for me while developing the picockpit-client. The following applies to Linux systems (but probably is applicable to all Unix like systems, including macOS) Python allows to run external commands using the subprocess module. import subprocess In the upcoming version of PiCockpit, users will be able to create their own buttons (simply editing…
WeiterlesenTermiShell: a web-based shell for the Raspberry Pi (development notes)
Introduction In the course of development of PiCockpit, I am going to add a web-based Terminal called TermiShell. TermiShell icon, by: Stephanie Harvey via unsplash.com TermiShell is going to allow you to log into your Raspberry Pi using PiCockpit.com (and the picockpit-client) – no additional application required on either side. This should be very comfortable,…
WeiterlesenPython Paho MQTT client self-signed certificates websockets, howto
Using Paho in Python with websockets and self-signed certificates for a https:// websocket connection has a couple of pitfalls, so I’m addressing this with some sample code here: import ssl import time import paho.mqtt.client as mqtt class PCPMQTTClient: def on_connect(self, client, userdata, flags, rc): self.connection_status = rc if rc == 0: self.connected_flag = True self.connection_error_flag…
Weiterlesenenvoy, docker and websockets – debugging and configuration
Websockets are an exciting technology, allowing you to upgrade a HTTP connection to a long-running persistent binary connection, which you can use to send bi-directional messages. As an aside, the MQTT protocol can be transported using websockets – which is the only (?) way for a JavaScript client delivered by the website, for instance. In…
WeiterlesenIntroduction to the SNAP protocol
Introduction S.N.A.P. is a protocol for communication between several connected hosts. It provides: · addressing · flags · ack/nak request · error detection (different error detection methods available) It can be run over different media, including RS485. It is optimized for a small footprint (limited computing, memory resources), but scaleable depending upon your needs. Basically,…
WeiterlesenPackaging Python projects for Debian / Raspbian with dh-virtualenv
This article aims to explain some things to developers which don’t use Python a lot, and might struggle with some of the concepts otherwise. I highly recommend the lecture of the following article as an introduction to the concepts discussed here: https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/ pypi.org pypi.org is an official repository of software for the Python programming language.…
Weiterlesen