Commit beee5c55 authored by Henrik Skov Midtiby's avatar Henrik Skov Midtiby

Experiments on autocompleting user names.

parent fc88f2bd
......@@ -144,6 +144,32 @@ def create_a_new_repository_in_group_example_two():
print(resp)
pprint.pprint(resp.json())
def get_user_details(username):
"""
Fetch details about the user with username "username".
"""
url = gitlab_url_api4("/users?username=%s" % username)
return requests.get(url,
headers={'Authorization': 'Bearer {}'.format(config.PersonalAcessToken)})
def get_user_details_example():
print("get_user_details")
resp = get_user_details("henrikmidtiby")
print(resp)
pprint.pprint(resp.json())
def autocomplete_user(username):
url = "https://source.coderefinery.org/autocomplete/users.json?search=%s&active=true" % username
#url = gitlab_url_api4("/users?username=%s" % username)
return requests.get(url,
headers={'Authorization': 'Bearer {}'.format(config.PersonalAcessToken)})
def autocomplete_user_example():
resp = autocomplete_user("hesc")
print(resp)
pprint.pprint(resp.json())
# Todos
# * Look up username to get the userid of the user (henrikmidtiby@gmail.com, # 646)
......@@ -158,18 +184,18 @@ def create_a_new_repository_in_group_example_two():
# List of assignments
assignment_name class
hw1-adam test2
hw1-birger test2
hw2-adam test2
hw2-birger test2
#assignment_name class
#hw1-adam test2
#hw1-birger test2
#hw2-adam test2
#hw2-birger test2
# List of students to add to a project
student_id assignment_name class
101 hw1-birger test2
105 hw1-adam test2
105 hw2-adam test2
#student_id assignment_name class
#101 hw1-birger test2
#105 hw1-adam test2
#105 hw2-adam test2
......@@ -179,9 +205,11 @@ student_id assignment_name class
# user id: 646 (henrikmidtiby@gmail.com)
# add_user_to_project_example()
# push_git_repository_content_to_project_example()
create_assignment_project_example()
# create_assignment_project_example()
# create_a_new_repository_in_group_example()
# create_a_new_repository_in_group_example_two()
#get_user_details_example()
autocomplete_user_example()
# SDU UAS Center - group_id = 453
# gitlab-experiments - group_id = 715
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment