FiloCara/pyS7 — reverse-engineered prompt
Reverse engineered prompt
Build me a small pure Python library for talking to Siemens S7 PLCs over ISO on TCP. I want it to feel simple to use, where I can create a client with an IP address, rack, and slot, connect to the PLC, then read or write values using easy address strings like DB1,X0.0, DB1,I30, M54.4, IW22, QR24, and DB1,S10.5.
It should support common PLC memory areas and data types like bits, bytes, words, signed and unsigned numbers, real numbers, chars, and strings. Please include a clean tag parser, a friendly S7Client API, and support reading several nearby variables efficiently instead of making lots of separate requests when they can be grouped.
Also add clear examples for reading and writing, basic tests for parsing and data handling, and a README that explains the address format and includes a strong safety warning about using this with real machines. Keep it lightweight with no external dependencies if possible.
Want more depth? Deep Reverse