Find a user by name
A useful Canvas API endpoint is:
GET /api/v1/search/recipients
This makes it easy to search for a user by name and as a side effect also produces information about what course you have in common with them. Thus if you are a teacher of their courses you can find this out.
A simple look by name can be done with:
./find_users_by_name.py
Download find_users_by_name.py user_name
For example (with some new lines added to format better on this page):
./find_users_by_name.py "gerald maguire" 'Wed Dec 19 08:07:36 2018' [{'id': 'section_1707', 'name': 'Maguire Jr., Gerald Q.', 'avatar_url': 'https://kth.instructure.com/images/messages/avatar-group-50.png', 'type': 'context', 'user_count': 6, 'permissions': {}, 'context_name': ' Degree Project at the School of Information and Communication Technology - Second Cycle'},
{'id': 'section_7031', 'name': 'Maguire Jr., Gerald Q.', 'avatar_url': 'https://kth.instructure.com/images/messages/avatar-group-50.png', 'type': 'context', 'user_count': 5, 'permissions': {}, 'context_name': 'Examensarbete vid Skolan för Informations- och kommunikationsteknik - Kandidatnivå (Degree project Bachelor)'},
{'id': 29, 'name': 'Gerald Q. Maguire Jr.', 'full_name': 'Gerald Q Maguire Jr', 'common_courses': {'6444': ['TeacherEnrollment', 'TeacherEnrollment', 'TeacherEnrollment'], '4948': ['TeacherEnrollment'], '4925': ['TeacherEnrollment'], '12684': ['TeacherEnrollment'],
'4946': ['TeacherEnrollment'],
'11544': ['TeacherEnrollment', 'TeacherEnrollment', 'TeacherEnrollment'], '4940': ['TeacherEnrollment'], '16039': ['TaEnrollment'], '2138': ['TeacherEnrollment'], '0': ['FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment', 'FakeEnrollment']},
'common_groups': {},
'avatar_url': 'https://secure.gravatar.com/avatar/52e6e0ae2260166c91cd528ba0c72263?s=50&d=http%3A%2F%2Fpeople.kth.se%2F%7Emaguire%2Fmaguire-march-2004-sq.jpg'}] 'Wed Dec 19 08:07:37 2018'
While getting the list of courses that you have in common with a user can be found with:
./find_users_courses_by_name.py
Download find_users_courses_by_name.py user_name