def getDoctorList(request): headers = { 'Authorization': 'Bearer %s' % (get_access_tokens()), } doctors = [] doctors_url = 'https://drchrono.com/api/doctors' while doctors_url: data = requests.get(doctors_url, headers=headers).json() doctors.extend(data['results']) doctors_url = data['next'] # A JSON null on the last page return doctors
def getPatientsList(request): headers = { 'Authorization': 'Bearer %s' % (get_access_tokens()), } patients = [] patients_url = 'https://drchrono.com/api/patients' while patients_url: data = requests.get(patients_url, headers=headers).json() patients.extend(data['results']) patients_url = data['next'] # A JSON null on the last page return patients