if handler_type == NM.KeyfileHandlerType.WRITE_CERT: # just to show how to abort the parsing. This event won't happen # for read. handler_data.fail_with_error( GLib.GError.new_literal( NM.ConnectionError.quark(), "hallo1", NM.ConnectionError.MISSINGPROPERTY ) ) # don't handle unknown handler types. return False try: print("parse keyfile...") c = NM.keyfile_read(kf, base_dir, NM.KeyfileHandlerFlags.NONE, kf_handler_read, 42) except Exception as e: print("parsing failed: %r" % (e)) raise verify_failure = None try: c.verify() except Exception as e: verify_failure = e.message print( 'parsing succeeded: "%s" (%s)%s' % ( c.get_id(), c.get_uuid(),