Home > Blockchain >  Make a get request with a multiple value param in django requests Module?
Make a get request with a multiple value param in django requests Module?

Time:05-22

I have a webservice that give doc list. I call this webservice via get_doc_list. but when I pass 2 values to id__in, it return one mapping object.

def get_doc_list(self, id__in):
        config = self.configurer.doc
        params = {
            "id__in": id__in,
        }
        response = self._make_request(
            token=self.access_token,
            method='get',
            proxies=self.proxies,
            url=config.service_url,
            params=params,
            module_name=self.module_name,
            finalize_response=False
        )
        return response

How can I fix it?!

CodePudding user response:

You can add this two lines before make_request:

string_id_in = [str(i) for i in id_in]
id_in = ",".join(string_id_in)
  • Related