This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Python script that decrypts the content of Kamstrup KEM file and imports meter files | |
# to wmbusmeters' config folder. | |
# | |
# The KEM file is a (sometimes zipped) xml file that contains xml-encrypted data using | |
# the xml-enc standard (http://www.w3.org/2001/04/xmlenc). The password needed to decrypt | |
# the xml-encrypted data can either be the CustomerId or something else selected by the | |
# person that has created the KEM file using Kamstrup software. | |
# | |
# This script takes the encrypted KEM file and decrypts its content (it automaticly detects | |
# the zip archive and extracts the kem file from it). The result is a XML with a list of meters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rpyc_deep_copy(obj): | |
""" | |
Makes a deep copy of netref objects that come as a result of RPyC remote method calls. | |
When RPyC client obtains a result from the remote method call, this result may contain | |
non-scalar types (List, Dict, ...) which are given as a wrapper class (a netref object). | |
This class does not have all the standard attributes (e.g. dict.tems() does not work) | |
and in addition the objects only exist while the connection is active (are weekly referenced). | |
To have a retuned value represented by python's native datatypes and to by able to use it | |
after the connection is terminated, this routine makes a recursive copy of the given object. | |
Currently, only `list` and `dist` types are supported for deep_copy, but other types may be |