Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Henrik Skov Midtiby
gitlab-assignment-handler
Commits
beee5c55
Commit
beee5c55
authored
May 15, 2020
by
Henrik Skov Midtiby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments on autocompleting user names.
parent
fc88f2bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
10 deletions
+38
-10
create_repository.py
create_repository.py
+38
-10
No files found.
create_repository.py
View file @
beee5c55
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment