Skip to content
Snippets Groups Projects
Commit 5a8c1e83 authored by williamforbrigd's avatar williamforbrigd
Browse files

fixed .gitignore and added endpoints

parent 178c3b60
No related branches found
No related tags found
No related merge requests found
bbcli/__pycache__
tests/__pycache__
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Django stuff:
*.log
*.pot
# Sphinx documentation
docs/_build/
\ No newline at end of file
File deleted
File deleted
File deleted
......@@ -14,6 +14,8 @@ def _version_callback(value: bool) -> None:
typer.echo(f"{__app_name__} v{__version__}")
raise typer.Exit()
@app.callback()
def main(
version: Optional[bool] = typer.Option(
......
......@@ -5,16 +5,16 @@ import pprint
import typer
#from string_builder import StringBuilder
import click
from typing import Optional
app = typer.Typer()
cookies = {'BbRouter': 'expires:1645188702,id:0E5CC03E415FE4459D9F34DDDFC4AEE7,signature:4e8d6fc59c11f744f6350399dc8cdf14f65a2c26d20e7d53c97141749e9056ac,site:f4fe20be-98b0-4ecd-9039-d18ce2989292,timeout:10800,user:15bd75dd85af4f56b31283276eb8da7c,v:2,xsrf:ac218e34-3110-415c-8718-bd0c8c8bcc8c'}
cookies = {'BbRouter': 'expires:1645202601,id:2480855EED2012DA032F19DEE1610883,signature:81a13d5bdf4946a82a632a9035c0f35811f217671da872677b1d1c32e7a3c339,site:f4fe20be-98b0-4ecd-9039-d18ce2989292,timeout:10800,user:15bd75dd85af4f56b31283276eb8da7c,v:2,xsrf:1bea7fee-fa91-4197-991f-1d266fd1ceee'}
base_url = 'https://ntnu.blackboard.com/learn/api/public/v1/'
@app.command()
def getuser(user_name: str = 'hanswf') -> None:
def getuser(user_name: str = typer.Argument('hanswf', help='Name of the user'))-> None:
'''
Get the user.
Specify the user_name as an option, or else it will use the default user_name
......@@ -42,7 +42,7 @@ def getcourse(course_id: str = 'IDATT2900'):
@app.command()
def getcoursecontents(course_id: str = '_27251_1'):
url = base_url + 'courses/%s/contents' % course_id
url = f'{base_url}courses/{course_id}/contents'
x = requests.get(url, cookies=cookies)
data = x.json()
print(pprint.pprint(data))
......
......@@ -6,7 +6,7 @@ runner = CliRunner()
def test_version():
# invokes the command line and checks the version
result = runner.invoke(cli.app, ["--version"])
result = runner.invoke(cli.app, ['--version'])
assert result.exit_code == 0
assert result.output == f"{__app_name__} v{__version__}\n"
......
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