Exemplo n.º 1
0
    def serialize(query_parameters):
        # type: (Dict[str, Any]) -> str

        for key, value in get_items(query_parameters):
            if isinstance(value, (list, dict)):
                value = json.dumps(value)
            elif isinstance(value, bool):
                value = 'true' if value else 'false'

            query_parameters[key] = value

        return urlencode(
            sorted(get_items(query_parameters), key=lambda val: val[0]))
    def serialize(query_parameters):
        # type: (Dict[str, Any]) -> str

        for key, value in get_items(query_parameters):
            if isinstance(value, (list, dict)):
                value = json.dumps(value)
            elif isinstance(value, bool):
                value = 'true' if value else 'false'

            query_parameters[key] = value

        return urlencode(
            sorted(get_items(query_parameters), key=lambda val: val[0])
        )
    def wait(self):
        # type: () -> MultipleIndexBatchIndexingResponse

        while not self._done:
            for index_name, task_id in get_items(self.raw_response['taskID']):
                self._client._sync().wait_task(index_name, task_id)
            self._done = True

        return self
Exemplo n.º 4
0
    def wait(self, request_options=None):
        # type: (Optional[Union[RequestOptions, dict]]) -> MultipleIndexBatchIndexingResponse # noqa: E501

        while not self._done:
            for index_name, task_id in get_items(self.raw_response["taskID"]):
                self._client._sync().wait_task(index_name, task_id, request_options)
            self._done = True

        return self
    def wait(self, request_options=None):
        # type: (Optional[Union[RequestOptions, dict]]) -> MultipleIndexBatchIndexingResponse # noqa: E501

        while not self._done:
            for index_name, task_id in get_items(self.raw_response['taskID']):
                self._client._sync().wait_task(
                    index_name,
                    task_id,
                    request_options
                )
            self._done = True

        return self
Exemplo n.º 6
0
    def deserialize(data):
        # type: (Dict[str, Any]) -> dict

        keys = {
            'attributesToIndex': 'searchableAttributes',
            'numericAttributesToIndex': 'numericAttributesForFiltering',
            'slaves': 'replicas',
        }

        for deprecated_key, current_key in get_items(keys):
            if deprecated_key in data:
                data[current_key] = data.pop(deprecated_key)

        return data
    def deserialize(data):
        # type: (Dict[str, Any]) -> dict

        keys = {
            'attributesToIndex': 'searchableAttributes',
            'numericAttributesToIndex': 'numericAttributesForFiltering',
            'slaves': 'replicas',
        }

        for deprecated_key, current_key in get_items(keys):
            if deprecated_key in data:
                data[current_key] = data.pop(deprecated_key)

        return data
    def deserialize(data):
        # type: (Dict[str, Any]) -> dict

        keys = {
            "attributesToIndex": "searchableAttributes",
            "numericAttributesToIndex": "numericAttributesForFiltering",
            "slaves": "replicas",
        }

        for deprecated_key, current_key in get_items(keys):
            if deprecated_key in data:
                data[current_key] = data.pop(deprecated_key)

        return data
    def create(config, options=None):
        # type: (Config, Optional[Dict[str, Any]]) -> RequestOptions

        headers = dict(config.headers)

        timeouts = {
            'readTimeout': int(config.read_timeout),
            'writeTimeout': int(config.write_timeout),
            'connectTimeout': int(config.connect_timeout),
        }

        request_options = RequestOptions(headers, {}, timeouts, {})

        for option, value in get_items(options):
            request_options[option] = value

        return request_options
    def create(config, options=None):
        # type: (Config, Optional[Dict[str, Any]]) -> RequestOptions

        headers = dict(config.headers)

        timeouts = {
            'readTimeout': int(config.read_timeout),
            'writeTimeout': int(config.write_timeout),
            'connectTimeout': int(config.connect_timeout),
        }

        request_options = RequestOptions(headers, {}, timeouts, {})

        for option, value in get_items(options):
            request_options[option] = value

        return request_options
Exemplo n.º 11
0
    def create(config, options=None):
        # type: (Config, Optional[Union[RequestOptions, Dict[str, Any]]]) -> RequestOptions  # noqa: E501

        if isinstance(options, RequestOptions):
            return copy.copy(options)

        headers = dict(config.headers)

        timeouts = {
            "readTimeout": int(config.read_timeout),
            "writeTimeout": int(config.write_timeout),
            "connectTimeout": int(config.connect_timeout),
        }

        request_options = RequestOptions(headers, {}, timeouts, {})

        for option, value in get_items(options):
            request_options[option] = value

        return request_options