Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IDATT2900-072
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mattias Agentoft Eggen
IDATT2900-072
Commits
5657149f
Commit
5657149f
authored
3 years ago
by
magnus2142
Browse files
Options
Downloads
Patches
Plain Diff
created structure
parent
f412cb5f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bbcli/Services/ContentService.py
+3
-0
3 additions, 0 deletions
bbcli/Services/ContentService.py
bbcli/Services/CourseService.py
+23
-0
23 additions, 0 deletions
bbcli/Services/CourseService.py
with
26 additions
and
0 deletions
bbcli/Services/ContentService.py
+
3
−
0
View file @
5657149f
This diff is collapsed.
Click to expand it.
bbcli/Services/CourseService.py
+
23
−
0
View file @
5657149f
import
json
from
typing
import
Dict
,
Any
import
requests
# TODO: use /term endpoint to determine whether the course is an active term
def
list_courses
(
cookies
:
Dict
,
user_name
:
str
)
->
Any
:
response
=
requests
.
get
(
'
https://ntnu.blackboard.com/learn/api/public/v1/users/userName:{}/courses
'
.
format
(
user_name
),
cookies
=
cookies
)
courses
=
json
.
loads
(
response
.
text
)[
'
results
'
]
detailed_course_list
=
[]
for
course
in
courses
:
detailed_course
=
list_course
(
cookies
=
cookies
,
course_id
=
course
[
'
courseId
'
])
detailed_course_list
.
append
(
detailed_course
)
return
detailed_course_list
def
list_course
(
cookies
:
Dict
,
course_id
:
str
)
->
Any
:
response
=
requests
.
get
(
'
https://ntnu.blackboard.com/learn/api/public/v3/courses/{}
'
.
format
(
course_id
),
cookies
=
cookies
)
return
json
.
loads
(
response
.
text
)
def
list_favorite_courses
(
cookies
:
Dict
,
user_name
:
str
)
->
Any
:
return
"
Blackboard rest api do not have an option for this yet
"
# response = requests.get('https://ntnu.blackboard.com/learn/api/public/v1/users/userName:{}/courses'.format(user_name), cookies=cookies)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment