Example #1
0
    def search_places_with_http_info(self, q, **kwargs):  # noqa: E501
        """Search for places via free-form query  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_places_with_http_info(q, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str q: Free-form query string (e.g. a city, neighborhood, state, ...) (required)
        :param int limit: Maximum number of entries to return
        :param str search_provider: The search provider (only geonames supported so far)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[Place], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['q', 'limit', 'search_provider']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method search_places" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'q' is set
        if self.api_client.client_side_validation and (
                'q' not in local_var_params or  # noqa: E501
                local_var_params['q'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `q` when calling `search_places`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'q' in local_var_params and local_var_params[
                'q'] is not None:  # noqa: E501
            query_params.append(('q', local_var_params['q']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'search_provider' in local_var_params and local_var_params[
                'search_provider'] is not None:  # noqa: E501
            query_params.append(
                ('search_provider',
                 local_var_params['search_provider']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/places',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[Place]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #2
0
    def test_with_http_info(self, **kwargs):  # noqa: E501
        """Shows all entries for Berlin Mitte (redirects to /all endpoint)  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.test_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = []
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method test" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/test',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='object',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #3
0
    def get_all_with_http_info(self, **kwargs):  # noqa: E501
        """Get all items for a place  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_all_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str place_name: The name of the place, e.g. a city, neighborhood, state (either place_name or geonames_id must be provided)
        :param int geonames_id: The geonames.org id of the place (either place_name or geonames_id must be provided)
        :param float max_distance: Maximum distance in degrees lon/lat for test sites
        :param int limit: Maximum number of test sites to return
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(ResultsList, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['place_name', 'geonames_id', 'max_distance', 'limit']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_all" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'place_name' in local_var_params and local_var_params[
                'place_name'] is not None:  # noqa: E501
            query_params.append(
                ('place_name', local_var_params['place_name']))  # noqa: E501
        if 'geonames_id' in local_var_params and local_var_params[
                'geonames_id'] is not None:  # noqa: E501
            query_params.append(
                ('geonames_id', local_var_params['geonames_id']))  # noqa: E501
        if 'max_distance' in local_var_params and local_var_params[
                'max_distance'] is not None:  # noqa: E501
            query_params.append(
                ('max_distance',
                 local_var_params['max_distance']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/all',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResultsList',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)