def __get_attachment()

in libmozdata/bugzilla.py [0:0]


    def __get_attachment(self):
        """Get the bug attachment"""
        header = self.get_header()
        if self.attachmentids:
            url = Bugzilla.API_URL + "/attachment/%s"
            ids = self.attachmentids
            field = "attachment_ids"
            cb = self.__attachment_cb
        else:
            url = Bugzilla.API_URL + "/%s/attachment"
            # TODO: remove next line after the fix of bug 1283392
            ids = self.__get_no_private_ids()
            field = "ids"
            cb = self.__attachment_bugs_cb

        for _ids in Connection.chunks(
            sorted(ids, key=lambda k: int(k)), chunk_size=Bugzilla.BUGZILLA_CHUNK_SIZE
        ):
            first = _ids[0]
            remainder = _ids[1:] if len(_ids) >= 2 else []
            self.attachment_results.append(
                self.session.get(
                    url % first,
                    headers=header,
                    params={
                        field: remainder,
                        "include_fields": self.attachment_include_fields,
                    },
                    verify=True,
                    timeout=self.TIMEOUT,
                    hooks={"response": cb},
                )
            )