🌍 Language / اللغة: English | العربية
This is a Python wrapper for Snap7, an open-source, 32/64 bit, multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs.
Python-snap7 is tested with Python 3.10+, on Windows, Linux and OS X.
The full documentation is available on Read The Docs.
- 📡 PLC Communication — Read/write data blocks, inputs, outputs, and memory areas
- 🔄 PLC Control — Start, stop, and cold/hot restart PLCs remotely
- 📊 Diagnostics — Read CPU info, status, and order code
- 🖥️ S7 Server — Built-in S7 server emulator for testing
- 🤝 Partner — Peer-to-peer communication between PLCs
- 🏗️ Logo Support — Siemens Logo PLC communication
- 🛠️ Utilities — Data conversion helpers for industrial data types
If you are running Windows (amd64), Mac OS X (amd64/aarch64), GNU/Linux (amd64/arm64) or a compatible platform you can install the binary wheel using:
$ pip install python-snap7
To use the CLI interface for running an emulator:
$ pip install "python-snap7[cli]"
Otherwise, please follow the online installation instructions to install python-snap7 from source.
import snap7
# Connect to a PLC
client = snap7.Client()
client.connect("192.168.0.1", 0, 0)
# Read data block
data = client.db_read(1, 0, 10)
print(f"Data: {data}")
# Disconnect
client.disconnect()Run with Docker:
$ docker build -t python-snap7 .
Or use Docker Compose:
$ docker-compose up
See the Docker documentation for more details.
We welcome contributions! Please see the Development Guide for details.
This project is licensed under the MIT License.