Skip to content
Snippets Groups Projects
Commit f412cb5f authored by magnus2142's avatar magnus2142
Browse files

Merge branch 'magnus_feature_architecture-pattern' into main

parents b087afb9 cd35a121
No related branches found
No related tags found
No related merge requests found
File moved
from urllib import request
import os
from dotenv import load_dotenv
# from RequestData import RequestData
from .RequestData import RequestData
from bbcli.Entities.RequestData import RequestData
import requests
import json
from bs4 import BeautifulSoup
......
......@@ -5,7 +5,6 @@ __app_name__ = "bbcli"
__version__ = "0.1.0"
# from .endpoints import *
from .Node import *
from .login import *
(
SUCCESS,
......
"""This module provides the RP To-Do CLI."""
# rptodo/cli.py
from typing import Optional
import typer
from bbcli import __app_name__, __version__, endpoints
import os
from dotenv import load_dotenv
from datetime import datetime
from bbcli import login
from bbcli.Services import AuthorizationService
app = typer.Typer()
app.add_typer(endpoints.app, name='endpoints', help='Call the endpoints')
......@@ -34,23 +30,50 @@ def check_valid_date() -> bool:
def _version_callback(value: bool) -> None:
if value:
typer.echo(f"{__app_name__} v{__version__}")
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 application's version and exit.",
'--version',
'-v',
help='Show the applications version and exit.',
callback=_version_callback,
is_eager=True,
)
) -> None:
if check_valid_date() == False:
login()
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():
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
......@@ -4,6 +4,15 @@ import requests
# import pprint
import typer
import bbcli.cli as cli
#from string_builder import StringBuilder
import click
from typing import Optional
from dotenv import load_dotenv
# from anytree import Node, RenderTree
import os
app = typer.Typer()
......
home = /Library/Frameworks/Python.framework/Versions/3.9/bin
home = /usr/bin
include-system-site-packages = false
version = 3.9.10
version = 3.8.10
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment