How to use the spyne.model.primitive.String function in spyne

To help you get started, we’ve selected a few spyne examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Linutronix / elbe / test / updated.py View on Github external
    @rpc(String)
    def msg(self, m):
        print(m)
github magma / magma / lte / gateway / python / magma / enodebd / tr069 / models.py View on Github external
_type_info["Data"] = XmlData(String)

    def __repr__(self):
        """For types we can't resolve only print the datum"""
        return self.Data


# SOAP Header Elements


class ID(Tr069ComplexModel):
    # Note: for some reason, XmlAttribute/XmlData pairs MUST be ordered, with
    # XmlAttribute coming first. This appears to be a spyne bug (something to do
    # with spyne.interface._base.add_class())
    _type_info = odict()
    _type_info["mustUnderstand"] = XmlAttribute(String, ns=SOAP_ENV)
    _type_info["Data"] = XmlData(String)


class HoldRequests(Tr069ComplexModel):
    _type_info = odict()
    _type_info["mustUnderstand"] = XmlAttribute(String, ns=SOAP_ENV)
    _type_info["Data"] = XmlData(Boolean)


# SOAP Fault Extensions


class SetParameterValuesFault(Tr069ComplexModel):
    _type_info = odict()
    _type_info["ParameterName"] = String
    _type_info["FaultCode"] = UnsignedInteger
github arskom / spyne / examples / cloth / simple.py View on Github external
    @rpc(String, UnsignedInteger, _returns=Iterable(String))
    def say_hello(ctx, name, times):
        def cb(ret):
            for i in range(times):
                ret.append('Hello, %s' % name)

        return Iterable.Push(cb)
github arskom / spyne / examples / authentication / server_soap.py View on Github external
return dict.__getitem__(self, key)
        except KeyError:
            raise PublicKeyError(key)


class RequestHeader(ComplexModel):
    __namespace__ = 'spyne.examples.authentication'

    session_id = Mandatory.String
    user_name = Mandatory.String


class Preferences(ComplexModel):
    __namespace__ = 'spyne.examples.authentication'

    language = String(max_len=2)
    time_zone = String


user_db = {
    'neo': bcrypt.hashpw('Wh1teR@bbit', bcrypt.gensalt()),
}

session_db = set()

preferences_db = SpyneDict({
    'neo': Preferences(language='en', time_zone='Underground/Zion'),
    'smith': Preferences(language='xx', time_zone='Matrix/Core'),
})


class AuthenticationService(Service):
github Linutronix / elbe / elbepack / updated.py View on Github external
    @rpc(String, _returns=String)
    def apply_snapshot(self, ver):
        if ver == "base_version":
            fname = "/etc/elbe_base.xml"
        else:
            fname = self.app.status.repo_dir + "/" + ver + "/new.xml"

        try:
            apply_update(fname, self.app.status)
        # pylint: disable=broad-except
        except Exception as err:
            print("%s" % str(err))
            self.app.status.set_finished('error')
            return "apply snapshot %s failed" % ver

        self.app.status.set_finished('OK')
        return "snapshot %s applied" % ver
github arskom / spyne / examples / cloth / push.py View on Github external
    @rpc(String, UnsignedInteger, _returns=Iterable(String))
    def say_hello(ctx, name, times):
        def cb(ret):
            for i in range(times):
                ret.append('Hello, %s' % name)
        return Iterable.Push(cb)
github angr / angr / ui_api.py View on Github external
	@srpc(String, String, String, _returns=String)
	def name_function(bin_name, func_addr, new_name):
		binaries[bin_name].functions()[func_addr].name = new_name
		return "success"
github arskom / spyne / examples / async.py View on Github external
    @rpc(String, _is_callback=True)
    def woke_up(ctx, message):
        pass
github arskom / spyne / examples / authentication / http_cookie / server_soap.py View on Github external
faultcode='Client.UnauthenticatedError',
                faultstring='This resource can only be accessed after authentication.'
            )

class SpyneDict(dict):
    def __getitem__(self, key):
        try:
            return dict.__getitem__(self, key)
        except KeyError:
            raise PublicKeyError(key)


class Preferences(ComplexModel):
    __namespace__ = 'spyne.examples.authentication'

    language = String(max_len=2)
    time_zone = String


user_db = {
    'neo': bcrypt.hashpw('Wh1teR@bbit', bcrypt.gensalt()),
}

session_db = set()

preferences_db = SpyneDict({
    'neo': Preferences(language='en', time_zone='Underground/Zion'),
    'smith': Preferences(language='xx', time_zone='Matrix/Core'),
})


class UserService(Service):
github angr / angr / ui_api.py View on Github external
	@srpc(String, String, _returns=String)
	def load_binary(bin_name, filename):
		if bin_name in binaries:
			return "already loaded"

		binaries[bin_name] = binary.Binary(filename)
		return "success"