doccano-client icon indicating copy to clipboard operation
doccano-client copied to clipboard

get_document_list doesn't work with offset>9

Open acrowther opened this issue 5 years ago • 2 comments

when calling method get_document_list using an offset parameter, the results are wrong when offset is greater than 9. There is an error in the build_url_parameter method, that split offset=15 to ?offset=1&offset=5

acrowther avatar Jun 15 '20 14:06 acrowther

I have found the same thing, I built a simple work around for myself. Changed the build_url_parameter to look like this:

    def build_url_parameter(
            self,
            url_parameter: dict
            ) -> str:
        """
        Format url_parameters.

        Args:
            url_parameter (dict): Every value must be a list.

        Returns:
            A URL parameter string. Ex: `?key1=u1&key1=u2&key2=v1&...`
        """
        params="".join([f"&{tup[0]}={tup[1]}" for tup in url_parameter.items()])
        return "?"+params[1:]

NelisVerhoef avatar Feb 24 '21 04:02 NelisVerhoef

I have found the same thing, I built a simple work around for myself. Changed the build_url_parameter to look like this:

    def build_url_parameter(
            self,
            url_parameter: dict
            ) -> str:
        """
        Format url_parameters.

        Args:
            url_parameter (dict): Every value must be a list.

        Returns:
            A URL parameter string. Ex: `?key1=u1&key1=u2&key2=v1&...`
        """
        params="".join([f"&{tup[0]}={tup[1]}" for tup in url_parameter.items()])
        return "?"+params[1:]

This works! thanks!

Why not open a PR?

wysohn avatar Sep 09 '21 21:09 wysohn