(requests, importer, location=None)
return data['dataSets'][0]['rows']
Send request to OpenMRS Reporting API and return results

    raises RequestException on request error
    raises ValueError if response is not JSON
    raises IndexError, KeyError, TypeError on unexpected JSON format
Send request to OpenMRS Reporting API and return results
Send request to OpenMRS Reporting API and return results
def get_openmrs_patients(requests, importer, location=None):
    """
    Send request to OpenMRS Reporting API and return results

    raises RequestException on request error
    raises ValueError if response is not JSON
    raises IndexError, KeyError, TypeError on unexpected JSON format
    """
    endpoint = f'/ws/rest/v1/reportingrest/reportdata/{importer.report_uuid}'
    params = parse_params(importer.report_params, location)

    for minutes in (5, 10, 20, 40):
        try:
            response = requests.get(
                endpoint,
                params=params,
                raise_for_status=True,
                timeout=(5, minutes * 60),  # connection timeout, read timeout
            )
            break
        except ReadTimeout:
            if minutes < 40:
                continue
            else:
                raise
    data = response.json()
    return data['dataSets'][0]['rows']
def get_openmrs_patients ( requests , importer , location = None ) : endpoint = f'/ws/rest/v1/reportingrest/reportdata/{importer.report_uuid}' params = parse_params ( importer . report_params , location ) for minutes in ( 5 , 10 , 20 , 40 ) : try : response = requests . get ( endpoint , params = params , raise_for_status = True , timeout = ( 5 , minutes * 60 ) , # connection timeout, read timeout ) break except ReadTimeout : if minutes < 40 : continue else : raise data = response . json ( ) return data [ 'dataSets' ] [ 0 ] [ 'rows' ]