Пример #1
0
class ServiceDateResult(ComplexModel):
    inn = String()
    firstname = String()
    surname = String()
    birthdate = Date()
    passport_ser = String()
    passport_num = String()
Пример #2
0
class Disinfection(ComplexModel):
    __namespace__ = ''
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Method = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Chemical = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    TemperatureTimes = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    Concentration = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
Пример #3
0
class SisMsg(ComplexModel):
    data_source = String(nillable=False,
                         min_occurs=1,
                         max_occurs=1,
                         max_len=50)
    direction = String(nillable=False, min_occurs=1, max_occurs=1, max_len=50)
    interface_name = String(nillable=False,
                            min_occurs=1,
                            max_occurs=1,
                            max_len=50)
    crt_dt = DateTime(nillable=False)
class transport(ComplexModel):
    __namespace__ = ''
    DeclaredType = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    DeclaredTypeCode = Integer.customize(max_occurs=1, min_occurs=0)
    Number = String.customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'DeclaredType': 'hello',
            'DeclaredTypeCode': 0,
            'Number': 'hello',
        }
class Man(ComplexModel):
    __namespace__ = ''
    ManName = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    ManFathername = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    ManFamily = String(max_len=100).customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'ManName': 'hello',
            'ManFathername': 'hello',
            'ManFamily': 'hello',
        }
class consignee(ComplexModel):
    __namespace__ = ''
    Name = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    Code = String(max_len=10).customize(max_occurs=1, min_occurs=0)
    Identifier = String(max_len=36).customize(max_occurs=1, min_occurs=0)
    Place = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    Address = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    AddressCode = String(max_len=36).customize(max_occurs=1, min_occurs=0)
    Agent = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    AgentCode = Integer.customize(max_occurs=1, min_occurs=0)
    Behalf = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    # man = Man
    Type = Integer.customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'Name': 'hello',
            'Code': 0,
            'Identifier': '0000000000',
            'Place': 'hello',
            'Address': 'hello',
            'AddressCode': 'hi',
            'Agent': 'hi',
            'AgentCode': 0,
            'Behalf': 'hi',
            'Type': 0,
        }
Пример #7
0
class NonNillableClass(ComplexModel):
    __namespace__ = "hunk.sunk"

    nillable = False
    min_occurs = 1

    dt = DateTime(min_occurs=1, nillable=False)
    i = Integer(nillable=False)
    s = String(min_len=1, nillable=False)
Пример #8
0
class HelloWorldService(ServiceBase):
    @rpc(String, Integer, _returns=String(max_occurs='unbounded'))
    def say_hello(ctx, name, times):
        results = []

        for i in range(0, times):
            results.append('Hello, %s' % name)

        return results
Пример #9
0
    def test_string(self):
        s = String()
        element = etree.Element('test')
        XmlDocument().to_parent(None, String, 'value', element, ns_test)
        element = element[0]

        self.assertEquals(element.text, 'value')
        value = XmlDocument().from_element(None, String, element)
        self.assertEquals(value, 'value')
Пример #10
0
class DynProtService(Service):
    protocols = {}

    @rpc(String(values=protocols.keys(), encoding='ascii'),
         _returns=DateTime,
         _patterns=[HttpPattern('/get_utc_time\\.<prot>')])
    def get_utc_time(ctx, prot):
        DynProtService.protocols[prot](ctx)

        return datetime.utcnow()
class request91(ComplexModel):
    __namespace__ = ''
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    Certificate = certificate
    Status = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    StatusCode = Integer.customize(max_occurs=1, min_occurs=0)
    Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            # 'GUID':
            'SendDateTime': 'hello',
            'certificate': Certificate,
            'Status': 'Выдан',
            'StatusCode': 'I dnt find',
            'Inspector': 'hello',
        }
Пример #12
0
class Consignee(ComplexModel):
    __namespace__ = ''
    Name = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    Code = String(max_len=10).customize(max_occurs=1, min_occurs=0)
    Identifier = String(max_len=36).customize(max_occurs=1, min_occurs=0)
    Place = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    Address = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    AddressCode = String(max_len=36).customize(max_occurs=1, min_occurs=0)
    Agent = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    AgentCode = Integer.customize(max_occurs=1, min_occurs=0)
    Behalf = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    man = Man
    Type = Integer.customize(max_occurs=1, min_occurs=0)
class disinfection(ComplexModel):
    __namespace__ = ''
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Method = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Chemical = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    TemperatureTimes = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    Concentration = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'Date': 'hello',
            'Method': 'hello',
            'Chemical': 'hello',
            'TemperatureTimes': 'hello',
            'Concentration': 'hello',
            'AdditionalInfo': 'hello',
        }
Пример #14
0
 class CM(ComplexModel):
     integer = Integer(sub_name='i')
     string = String(sub_name='s')
Пример #15
0
class GraphPlotValue(ComplexModel):
    __namespace__ = "graphSST"
    key = Integer()
    lat = Float()
    sst = Float()
    date_use = String()
Пример #16
0
class feature(ComplexModel):
    name = String()
    value = String()
Пример #17
0
from spyne import Boolean, ComplexModel, Integer, String

from soapser import NAMESPACE

StringNonNillable = String(nillable=False)
StringMinOcc1 = String(min_occurs=1)


class Extensions(ComplexModel):
    __namespace__ = NAMESPACE

    _type_info = [
        ('FieldCode', StringNonNillable(min_occurs=1)),
        ('FieldCodeDesc', StringNonNillable),
        ('FieldValue', StringNonNillable(min_occurs=1)),
        ]

class ItemAttributes(ComplexModel):
    __namespace__ = NAMESPACE

    _type_info = [
        ('AttributeTypeId', StringMinOcc1),
        ('AttributeTypeDesc', StringMinOcc1),
        ('AttributeHeaderId', StringMinOcc1),
        ('AttributeHeaderDesc', StringMinOcc1),
        ('AttributeCodeId', StringMinOcc1),
        ('AttributeCode', StringMinOcc1),
        ('AttributeCodeDesc', StringMinOcc1),
        ]

class Slotting(ComplexModel):
class DictWage(ServiceBase):
    @rpc(
        Date(
            min_occurs=1,
            doc='Дата на яку потрібна мінімальна заробітна плата'
        ),
        _returns=MinWage)
    def GetMinWage(ctx, DateWage):
        if isinstance(ctx.in_document, _Element):
            header = root_etree_to_dict(
                etree_strip_namespaces(ctx.in_document)
            )['Envelope'][0]['Header'][0]
            ctx.udc.logger.info('Header: %s', header)

        Wage = read_dict('Wage.json')
        mw = MinWage()
        for w in Wage:
            end = w.get('end') or datetime.date(2999, 12, 31)
            if w.get('start') <= DateWage <= end:
                mw.MinWageMonth = w.get('wage')
                mw.MinWageHour = w.get('wage_h')
                mw.Begin = w.get('start')
                mw.End = end
        return mw

    @rpc(
        Date(
            min_occurs=1,
            doc='Дата на яку потрібн пржитковий мінімум'
        ),
        _returns=LWage)
    def GetCostOfLiving(ctx, DateWage):
        if isinstance(ctx.in_document, _Element):
            header = root_etree_to_dict(
                etree_strip_namespaces(ctx.in_document)
            )['Envelope'][0]['Header'][0]
            ctx.udc.logger.info('Header: %s', header)

        Wage = read_dict('ProsperousMin.json')
        lw = LWage()
        for w in Wage:
            end = w.get('end') or datetime.date(2999, 12, 31)
            if w.get('start') <= DateWage <= end:
                lw.CostOfLiving = w.get('ProsperousMin')
                lw.CostOfLiving6 = w.get('ProsperousMin6')
                lw.CostOfLiving18 = w.get('ProsperousMin18')
                lw.CostOfLivingEmployable = w.get('ProsperousMinEmployable')
                lw.CostOfLivingInvalid = w.get('ProsperousMinInvalid')
                lw.Begin = w.get('start')
                lw.End = end
        return lw

    @rpc(MinWage, _returns=String())
    def PutMinWage(ctx, MinWage):
        header = None
        if isinstance(ctx.in_document, _Element):
            header = root_etree_to_dict(
                etree_strip_namespaces(ctx.in_document)
            )['Envelope'][0]['Header'][0]
            ctx.udc.logger.info('Header: %s', header)

        if not header:
            return 'Вам не можно вносити зміни'
        if header.get('userId')[0] != ctx.udc.config.get('USERID'):
            return 'Вам не можно вносити зміни!'
        if header.get('token')[0] != ctx.udc.config.get('TOKEN'):
            return 'Вам не можно вносити зміни!!'

        Wage = read_dict('Wage.json')
        for w in Wage:
            if w.get('end'):
                continue
            if w.get('start') > MinWage.Begin:
                return "Дата початку не може бути меньш ніж %s" % w.get('start')
            w.update({'end': MinWage.Begin - datetime.timedelta(1)})

        Wage.append({
            "start": MinWage.Begin,
            "end": None,
            "wage": MinWage.MinWageMonth,
            "wage_h": MinWage.MinWageHour
        })
        with open('./data/Wage.json', 'w', encoding='utf-8') as f:
            json.dump(Wage, f, ensure_ascii=False,
                      indent=4, default=dtoc)

        return "OK"

    @rpc(LWage, _returns=String())
    def PutCostOfLiving(ctx, ProsperousMin):
        header = None
        if isinstance(ctx.in_document, _Element):
            header = root_etree_to_dict(
                etree_strip_namespaces(ctx.in_document)
            )['Envelope'][0]['Header'][0]
            ctx.udc.logger.info('Header: %s', header)

        if not header:
            return 'Вам не можно вносити зміни'
        if header.get('userId')[0] != ctx.udc.config.get('USERID'):
            return 'Вам не можно вносити зміни!'
        if header.get('token')[0] != ctx.udc.config.get('TOKEN'):
            return 'Вам не можно вносити зміни!!'

        Wage = read_dict('ProsperousMin.json')
        for w in Wage:
            if w.get('end'):
                continue
            if w.get('start') > ProsperousMin.Begin:
                return "Дата початку не може бути меньш ніж %s" % w.get('start')
            w.update({
                'end': ProsperousMin.Begin - datetime.timedelta(1)
            })

        Wage.append({
            "start": ProsperousMin.Begin,
            "end": None,
            "ProsperousMin": ProsperousMin.CostOfLiving,
            "ProsperousMin6": ProsperousMin.CostOfLiving6,
            "ProsperousMin18": ProsperousMin.CostOfLiving18,
            "ProsperousMinEmployable": ProsperousMin.CostOfLivingEmployable,
            "ProsperousMinInvalid": ProsperousMin.CostOfLivingInvalid
        })

        with open('./data/ProsperousMin.json', 'w', encoding='utf-8') as f:
            json.dump(Wage, f, ensure_ascii=False,
                      indent=4, default=dtoc)

        return "OK"
Пример #19
0
class Permission(ComplexModel):
    __namespace__ = "permission"

    app = String(values=['library', 'delivery', 'accounting'])
    perms = String(min_occurs=1, max_occurs=2, values=['read', 'write'])
Пример #20
0
class response(ComplexModel):
    identifier = Unicode()
    decision = String()
Пример #21
0
class Daemon(ComplexModel):
    """A couple of neurons."""

    LOGGING_DEVEL_FORMAT = "%(module)-15s | %(message)s"
    LOGGING_PROD_FORMAT = "%(asctime)s | %(module)-8s | %(message)s"

    _type_info = [
        ('uuid',
         Uuid(no_cli=True,
              help="Daemon uuid. Regenerated every time a new "
              "config file is written. It could come in handy.")),
        ('secret',
         ByteArray(no_cli=True,
                   help="Secret key for signing cookies "
                   "and other stuff.")),
        ('daemonize',
         Boolean(default=False, help="Daemonizes before everything else.")),
        ('uid',
         Unicode(help="The daemon user. You need to start the server as"
                 " a priviledged user for this to work.")),
        ('gid',
         Unicode(help="The daemon group. You need to start the server as"
                 " a priviledged user for this to work.")),
        ('pid_file',
         String(help="The path to a text file that contains the pid"
                "of the daemonized process.")),
        ('logger_dest',
         String(
             help="The path to the log file. The server won't"
             " daemonize without this. Converted to an absolute path if not.")
         ),
        ('log_rpc', Boolean(help="Log raw rpc data.")),
        ('log_queries', Boolean(help="Log sql queries.")),
        ('log_results',
         Boolean(help="Log query results in addition to queries"
                 "themselves.")),
        ('main_store',
         Unicode(help="The name of the store for binding "
                 "neurons.TableModel's metadata to.")),
        ('bootstrap',
         Boolean(help="Bootstrap the application. Create schema, "
                 "insert initial data, etc.",
                 no_config=True)),
        ('_services', Array(Service, sub_name='services')),
        ('_stores', Array(StorageInfo, sub_name='stores')),
        ('_loggers', Array(Logger, sub_name='loggers')),
    ]

    # FIXME: we need this atrocity with custom constructor and properties
    # because spyne doesn't support custom containers
    def __init__(self, *args, **kwargs):
        super(Daemon, self).__init__(*args, **kwargs)

        services = kwargs.get('services', None)
        if services is not None:
            self.services = services
        if not hasattr(self, 'services') or self.services is None:
            self.services = _Twrdict('name')()

        stores = kwargs.get('stores', None)
        if stores is not None:
            self.stores = stores
        if not hasattr(self, 'stores') or self.stores is None:
            self.stores = _wdict()

        loggers = kwargs.get('loggers', None)
        if loggers is not None:
            self.loggers = loggers
        if not hasattr(self, 'loggers') or self.loggers is None:
            self.loggers = _wdict()

    @property
    def _services(self):
        if self.services is not None:
            for k, v in self.services.items():
                v.name = k

            return self.services.values()

        self.services = _Twrdict('name')()
        return []

    @_services.setter
    def _services(self, what):
        self.services = what
        if what is not None:
            self.services = _Twrdict('name')([(s.name, s) for s in what])

    @property
    def _stores(self):
        if self.stores is not None:
            for k, v in self.stores.items():
                v.name = k

            return self.stores.values()

        self.stores = _wdict()
        return []

    @_stores.setter
    def _stores(self, what):
        self.stores = what
        if what is not None:
            self.stores = _wdict([(s.name, s) for s in what])

    @property
    def _loggers(self):
        if self.loggers is not None:
            for k, v in self.loggers.items():
                v.name = k

            return self.loggers.values()

        self.loggers = _wdict()
        return []

    @_loggers.setter
    def _loggers(self, what):
        self.loggers = what
        if what is not None:
            self.loggers = _wdict([(s.path, s) for s in what])

    @classmethod
    def get_default(cls, daemon_name):
        return cls(
            uuid=uuid1(),
            secret=os.urandom(64),
            _stores=[
                Relational(
                    name="sql_main",
                    backend="sqlalchemy",
                    pool_size=10,
                    pool_recycle=3600,
                    pool_timeout=30,
                    max_overflow=3,
                    conn_str='postgres://postgres:@localhost:5432/%s_%s' %
                    (daemon_name, getpass.getuser()),
                    sync_pool=True,
                    async_pool=True,
                ),
            ],
            main_store='sql_main',
            _loggers=[
                Logger(path='.',
                       level='DEBUG',
                       format=cls.LOGGING_DEVEL_FORMAT),
            ],
        )

    def apply_logging(self):
        # We're using twisted logging only for IO.
        from twisted.python.logger import FileLogObserver
        from twisted.python.logger import Logger, LogLevel, globalLogPublisher

        LOGLEVEL_TWISTED_MAP = {
            logging.DEBUG: LogLevel.debug,
            logging.INFO: LogLevel.info,
            logging.WARN: LogLevel.warn,
            logging.ERROR: LogLevel.error,
            logging.CRITICAL: LogLevel.critical,
        }

        class TwistedHandler(logging.Handler):
            def emit(self, record):
                assert isinstance(record, logging.LogRecord)
                Logger(record.name).emit(LOGLEVEL_TWISTED_MAP[record.levelno],
                                         log_text=self.format(record))

        if self.logger_dest is not None:
            from twisted.python.logfile import DailyLogFile

            self.logger_dest = abspath(self.logger_dest)
            if access(dirname(self.logger_dest), os.R_OK | os.W_OK):
                log_dest = DailyLogFile.fromFullPath(self.logger_dest)

            else:
                Logger().warn("%r is not accessible. We need rwx on it to "
                              "rotate logs." % dirname(self.logger_dest))
                log_dest = open(self.logger_dest, 'wb+')

            formatter = logging.Formatter(self.LOGGING_PROD_FORMAT)

        else:
            formatter = logging.Formatter(self.LOGGING_DEVEL_FORMAT)
            log_dest = open('/dev/stdout', 'wb+')

            try:
                import colorama
                colorama.init()
                logger.debug("colorama loaded.")

            except Exception as e:
                logger.debug("coloarama not loaded: %r" % e)

        def record_as_string(record):
            if 'log_text' in record:
                return record['log_text'] + "\n"
            if 'message' in record:
                return record['message'] + "\n"
            if 'log_failure' in record:
                failure = record['log_failure']
                return "%s: %s" % (failure.type, pformat(vars(failure.value)))
            return pformat(record)

        observer = FileLogObserver(log_dest, record_as_string)
        globalLogPublisher.addObserver(observer)

        handler = TwistedHandler()
        handler.setFormatter(formatter)
        logging.getLogger().addHandler(handler)

        for l in self._loggers or []:
            l.apply()

        if self.log_rpc or self.log_queries or self.log_results:
            logging.getLogger().setLevel(logging.DEBUG)

        if self.log_rpc:
            logging.getLogger('spyne.protocol').setLevel(logging.DEBUG)
            logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG)
            logging.getLogger('spyne.protocol.dictdoc').setLevel(logging.DEBUG)

        if self.log_queries:
            logging.getLogger('sqlalchemy').setLevel(logging.INFO)

        if self.log_results:
            logging.getLogger('sqlalchemy').setLevel(logging.DEBUG)

    def sanitize(self):
        if self.logger_dest is not None:
            self.logger_dest = abspath(self.logger_dest)
        if self.pid_file is not None:
            self.pid_file = abspath(self.pid_file)

    def apply(self, for_testing=False):
        """Daemonizes the process if requested, then sets up logging and data
        stores.
        """

        # FIXME: apply_storage could return a deferred due to txpool init.

        # Daemonization won't work if twisted is imported before fork().
        # It's best to know this in advance or you'll have to deal with daemons
        # that work perfectly well in development environments but won't boot
        # in production ones, solely because of fork()ingw.
        assert for_testing or not ('twisted' in sys.modules), \
                                                "Twisted is already imported!"

        self.sanitize()
        if self.daemonize:
            assert self.logger_dest, "Refusing to start without any log output."
            daemonize()

        self.apply_logging()

        if self.pid_file is not None:
            pid = os.getpid()
            with open(self.pid_file, 'w') as f:
                f.write(str(pid))
                logger.debug("Pid file is at: %r", self.pid_file)

        self.apply_storage()

    def apply_storage(self):
        for store in self._stores or []:
            try:
                store.apply()
            except Exception as e:
                logger.exception(e)
                raise

            if self.main_store == store.name:
                engine = store.itself.engine

                import neurons
                neurons.TableModel.Attributes.sqla_metadata.bind = engine

    @classmethod
    def parse_config(cls, daemon_name, argv=None):
        _apply_custom_attributes(cls)
        retval = cls.get_default(daemon_name)
        file_name = abspath('%s.yaml' % daemon_name)

        argv_parser = spyne_to_argparse(cls)
        cli = {}
        if argv is not None and len(argv) > 1:
            cli = dict(argv_parser.parse_args(argv[1:]).__dict__.items())
            if cli['config_file'] is not None:
                file_name = abspath(cli['config_file'])
                del cli['config_file']

        exists = isfile(file_name) and os.access(file_name, os.R_OK)
        if exists:
            retval = yaml_loads(open(file_name).read(),
                                cls,
                                validator='soft',
                                polymorphic=True)
        else:
            if not access(dirname(file_name), os.R_OK | os.W_OK):
                raise Exception("File %r can't be created in %r" %
                                (file_name, dirname(file_name)))

        for k, v in cli.items():
            if not v in (None, False):
                setattr(retval, k, v)

        retval.config_file = file_name

        return retval

    def write_config(self):
        open(self.config_file, 'wb').write(
            get_object_as_yaml(self, self.__class__, polymorphic=True))
Пример #22
0
class Certificate(ComplexModel):
    __namespace__ = ''
    ID = Integer.customize(max_occurs=1, min_occurs=0)
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    Number = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Blanc = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    DepartureCountry = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    DepartureCountryCode = String(max_len=2).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountry = String(max_len=100).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountryCode = String(max_len=2).customize(max_occurs=1,
                                                         min_occurs=0)
    EntryCheckpoint = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    EntryCheckpointCode = Integer.customize(max_occurs=1, min_occurs=0)
    consignor = Consignor
    consignee = Consignee
    transport = Transport
    disinfection = Disinfection
    productdescription = ProductDescription
    GeneralMarking = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    GeneralQuarantineCondition = String(max_len=512).customize(max_occurs=1,
                                                               min_occurs=0)
    GeneralBaseDocument = String(max_len=512).customize(max_occurs=1,
                                                        min_occurs=0)
    GeneralAdditionalDeclaration = String(max_len=512).customize(max_occurs=1,
                                                                 min_occurs=0)
    GeneralMandatoryActions = String(max_len=512).customize(max_occurs=1,
                                                            min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
    Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    AnnexDoc = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    AnnexText = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    PDF = ByteArray.customize(max_occurs=1, min_occurs=0)
class response(ComplexModel):
    __namespace__ = SOAP_DATAROBOT
    identifier = Unicode()
    decision = String()
Пример #24
0
class Transport(ComplexModel):
    __namespace__ = ''
    DeclaredType = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    DeclaredTypeCode = Integer.customize(max_occurs=1, min_occurs=0)
    Number = String.customize(max_occurs=1, min_occurs=0)
class certificate(ComplexModel):
    __namespace__ = ''
    ID = Integer.customize(max_occurs=1, min_occurs=0)
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    Number = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Blanc = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    DepartureCountry = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    DepartureCountryCode = String(max_len=2).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountry = String(max_len=100).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountryCode = String(max_len=2).customize(max_occurs=1,
                                                         min_occurs=0)
    EntryCheckpoint = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    EntryCheckpointCode = Integer.customize(max_occurs=1, min_occurs=0)
    Consignor = consignor
    Consignee = consignee
    Transport = transport
    Disinfection = disinfection
    Productdescription = productDescription
    GeneralMarking = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    GeneralQuarantineCondition = String(max_len=512).customize(max_occurs=1,
                                                               min_occurs=0)
    GeneralBaseDocument = String(max_len=512).customize(max_occurs=1,
                                                        min_occurs=0)
    GeneralAdditionalDeclaration = String(max_len=512).customize(max_occurs=1,
                                                                 min_occurs=0)
    GeneralMandatoryActions = String(max_len=512).customize(max_occurs=1,
                                                            min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
    Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    AnnexDoc = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    AnnexText = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    # PDF = ByteArray.customize(max_occurs=1, min_occurs=0)

    #         'Blanc'omize(max_occurs=1, min_occurs=0)
    # PDF = ByteArray.customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'ID': 'hello',
            # Guid
            'SendDateTime': 'hello',
            'Number': 'hello',
            'Date': 'hello',
            'Blanc': 'hi',
            'DepartureCountry': 'hello',
            'DepartureCountryCode': 'hello',
            'DestinationCountry': 'hello',
            'DestinationCountryCode': 'hello',
            'consignor': Consignor,
            'consignee': Consignee,
            'transport': Transport,
            'disinfection': Disinfection,
            'productDescription': ProductDescription,
            'GeneralMarking': 'hello',
            'GeneralQuarantineCondition': 'Карантинных объектов не обнаружено',
            'GeneralBaseDocument': 'hi',
            'GeneralAdditionalDeclaration': 'hello',
            'GeneralMandatoryActions': 'hello',
            'AdditionalInfo': 'hello',
            'Inspector': 'hello',
        }
class productDescription(ComplexModel):
    __namespace__ = ''
    NameRus = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    NameEng = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    NameBotanic = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    Code = Integer.customize(max_occurs=1, min_occurs=0)
    HS = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    # we have to find datatype of HSCode
    HSCode = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    OriginPlace = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    OriginCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    OriginCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0)
    Manufacturer = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    ManufacturerCode = Integer.customize(max_occurs=1, min_occurs=0)
    Quantity = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantityUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    QuantityUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantityGross = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantityGrossUnit = String(max_len=100).customize(max_occurs=1,
                                                      min_occurs=0)
    QuantityGrossUnitCode = String(max_len=3).customize(max_occurs=1,
                                                        min_occurs=0)
    QuantitySpecial = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantitySpecialUnit = String(max_len=100).customize(max_occurs=1,
                                                        min_occurs=0)
    QuantitySpecialUnitCode = String(max_len=3).customize(max_occurs=1,
                                                          min_occurs=0)
    Packages = Integer.customize(max_occurs=1, min_occurs=0)
    PackagesUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    PackagesUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0)
    # we have to find datatypes of PackagesType and PackagesTypeCode
    PackagesType = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    PackagesTypeCode = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    PackagesDescription = String(max_len=512).customize(max_occurs=1,
                                                        min_occurs=0)
    Volume = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    VolumeUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    VolumeUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0)
    Marking = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'NameRus': 'hello',
            'NameEng': 'hello',
            'NameBotanic': 'hello',
            'Code': 'hello',
            'HS': 'hi',
            'HSCode': 'hello',
            'OriginPlace': 'Tashkent',
            'OriginCountry': 'hello',
            'OriginCountryCode': 'hello',
            'Manufacturer': 'hi',
            'ManufacturerCode': 0,
            'Quantity': 'hello',
            'QuantityUnit': 'hello',
            'QuantityUnitCode': 90,
            'QuantityGross': 'hello',
            'PackagesUnit': 'hello',
            'PackageUnitCode': 'hello',
            'PackagesType': 'hi',
            'PackagesTypeCode': 0,
            'PackagesDescription': 'hi',
            'Volume': 0,
            'VolumeUnit': 'hi',
            'VolumeUnitCode': 0,
            'Marking': 'hi',
            'AdditionalInfo': 'hi',
        }
Пример #27
0
class Man(ComplexModel):
    __namespace__ = ''
    ManName = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    ManFathername = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    ManFamily = String(max_len=100).customize(max_occurs=1, min_occurs=0)
Пример #28
0
class ProductDescription(ComplexModel):
    __namespace__ = ''
    NameRus = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    NameEng = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    NameBotanic = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    Code = Integer.customize(max_occurs=1, min_occurs=0)
    HS = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    # we have to find datatype of HSCode
    HSCode = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    OriginPlace = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    OriginCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    OriginCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0)
    Manufacturer = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    ManufacturerCode = Integer.customize(max_occurs=1, min_occurs=0)
    Quantity = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantityUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    QuantityUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantityGross = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantityGrossUnit = String(max_len=100).customize(max_occurs=1,
                                                      min_occurs=0)
    QuantityGrossUnitCode = String(max_len=3).customize(max_occurs=1,
                                                        min_occurs=0)
    QuantitySpecial = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    QuantitySpecialUnit = String(max_len=100).customize(max_occurs=1,
                                                        min_occurs=0)
    QuantitySpecialUnitCode = String(max_len=3).customize(max_occurs=1,
                                                          min_occurs=0)
    Packages = Integer.customize(max_occurs=1, min_occurs=0)
    PackagesUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    PackagesUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0)
    # we have to find datatypes of PackagesType and PackagesTypeCode
    PackagesType = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    PackagesTypeCode = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    PackagesDescription = String(max_len=512).customize(max_occurs=1,
                                                        min_occurs=0)
    Volume = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0)
    VolumeUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    VolumeUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0)
    Marking = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)