Exemplo n.º 1
0
    def __init__(self,
                 name,
                 path,
                 method='GET',
                 is_json=None,
                 is_debug=None,
                 trace=None,
                 timeout=None,
                 handler=None,
                 wrapper=None,
                 setup=None,
                 is_form=None):
        self.name = name
        self.path = path
        self.method = method
        self.is_json = config_file.validate_bool(
            is_json) if is_json is not None else None
        self.is_debug = config_file.validate_bool(
            is_debug) if is_debug is not None else None
        self.trace = config_file.validate_bool(
            trace) if trace is not None else None
        self.timeout = float(timeout) if timeout is not None else None
        self.handler = handler
        self.wrapper = wrapper
        self.setup = setup
        self.is_form = config_file.validate_bool(
            is_form) if is_form is not None else None

        self.required = []
        self.optional = {}
        self.headers = None
Exemplo n.º 2
0
    def __init__(self,
                 name,
                 url=None,
                 is_json=True,
                 is_debug=False,
                 timeout=5.0,
                 handler=None,
                 wrapper=None,
                 setup=None,
                 is_form=False,
                 code=None):
        self.name = name
        self.url = url
        self.is_json = config_file.validate_bool(is_json)
        self.is_debug = config_file.validate_bool(is_debug)
        self.timeout = float(timeout)
        self.handler = handler
        self.wrapper = wrapper
        self.setup = setup
        self.is_form = config_file.validate_bool(is_form)
        self.code = code

        self.headers = {}
        self.resources = {}
        self._resource = None
Exemplo n.º 3
0
 def act_add_resource(self):
     resource = Resource(*self.args, **self.kwargs)
     if resource.name in self.connection:
         self.error = 'duplicate connection resource: %s' % resource.name
     else:
         self.connection.add_resource(resource)
         self._add_config(
             'connection.%s.resource.%s.is_debug' %
             (self.connection.name, resource.name),
             value=config_file.validate_bool(resource.is_debug)
             if resource.is_debug is not None else None,
             validator=config_file.validate_bool,
         )
Exemplo n.º 4
0
 def act_silent(self):
     if len(self.args) != 1:
         raise Exception('one argument must be specified')
     self.server.set_silent(config_file.validate_bool(self.args[0]))