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
9f5983c3
Commit
9f5983c3
authored
3 years ago
by
magnus2142
Browse files
Options
Downloads
Patches
Plain Diff
cleaned up test code
parent
c61fb477
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bbcli/cli.py
+2
-53
2 additions, 53 deletions
bbcli/cli.py
with
2 additions
and
53 deletions
bbcli/cli.py
+
2
−
53
View file @
9f5983c3
...
...
@@ -3,10 +3,10 @@ from typing import Optional
from
pkg_resources
import
EntryPoint
# import typer
from
bbcli
import
__app_name__
,
__version__
from
bbcli.endpoints
import
get_user
,
get_course
,
get_course_contents
,
get_assignments
from
bbcli.endpoints
import
get_user
,
get_course_contents
,
get_assignments
import
os
from
dotenv
import
load_dotenv
from
bbcli
import
check_valid_date
from
bbcli
import
check_valid_date
,
check_response
import
click
from
bbcli.Services
import
AuthorizationService
...
...
@@ -17,66 +17,15 @@ def entry_point():
pass
entry_point
.
add_command
(
get_user
)
entry_point
.
add_command
(
get_course
)
entry_point
.
add_command
(
get_course_contents
)
entry_point
.
add_command
(
get_assignments
)
# app = typer.Typer()
# app.add_typer(endpoints.app, name='endpoints', help='Call the endpoints')
load_dotenv
()
cookies
=
{
'
BbRouter
'
:
os
.
getenv
(
"
BB_ROUTER
"
)}
headers
=
{
'
X-Blackboard-XSRF
'
:
os
.
getenv
(
'
XSRF
'
)}
# def _version_callback(value: bool) -> None:
# if value:
# typer.echo(f'{__app_name__} v{__version__}')
# raise typer.Exit()
# @app.callback()
# def main(
# version: Optional[bool] = typer.Option(
# None,
# '--version',
# '-v',
# help='Show the applications version and exit.',
# callback=_version_callback,
# is_eager=True,
# )
# ) -> None:
# if check_valid_date(cookies) == False:
# AuthorizationService.login()
# # load_dotenv()
# # cookies['BbRouter'] = os.getenv("BB_ROUTER")
# # headers['X-Blackboard-XSRF'] = os.getenv("XSRF")
# return
#----- AUTHORIZATION MODULE -----#
# @app.command(name='login', help='Authorize the user.')
def
authorize_user
():
if
check_valid_date
(
cookies
)
==
False
:
AuthorizationService
.
login
()
#----- COURSE MODULE -----#
# @app.command(name='course')
# def course(
# course_id: Optional[str] = typer.Argument(None, help='The id of the course you want.'),
# favorites: bool = typer.Option(False, help='List only your favorite courses.')):
# if course_id != None and favorites == False:
# # CODE FOR GETTING SPESIFIC COURSE
# print('getting spesific course...')
# elif course_id != None and favorites == True:
# # CODE FOR GETTING SPESIFIC FAVORITE COURSE
# print('getting spesific favorite course...')
# else:
# # CODE FOR GETTING ALL COURSES
# print('getting all courses...')
\ No newline at end of file
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