def gen_org_units(self):
        """
        Yields organisation units
        """
        page = 1
        while True:
            response = self._request.get(
                'organisationUnits',
                params={
                    'paging': 'true',
                    'pageSize': 500,
                    'page': page,
                    'links': 'false'
                })
            for org_unit in response['organisationUnits']:
                yield org_unit
            if page < response['pager']['pageCount']:
                page += 1
            else:
                break
dataset/ETHPy150Open dimagi/commcare-hq/custom/dhis2/models.py/Dhis2Api.gen_org_units/original