Blackboard REST APIs... for humans?
mdeakyne, updated
🕥
2022-12-08 02:54:11
BbRest
Blackboard REST APIs... for humans? (TM)
Purpose
This Python library was created to make the Blackboard REST API more accessible.
Specifically, it helps solve a few problems:
Token Management
Blackboard tokens expire in one hour, and cannot be expired manually.
It's possible that two uses of one app would be called within an hour of
starting the other - in this case, the session expires in less than an hour.
A call with an expired token returns a 401 error.
This wrapper has a self healing session that renews the token when needed.
API availability by version
All APIs documented on developer.blackboard.com are not available for all versions of self and managed hosted clients. The terminology is even a bit hard to decipher, as it doesn't match the QX 20XX format most admins are used to.
This wrapper will create functions that only allows calling available functions, depending on the version of Blackboard it connects to. This has recently been improved by the distinct versions for .json.
Finding APIs
It can be difficult to find the correct API on developers.blackboard.com, and this wrapper allows you to tab complete generated APIs and to get hints about expected inputs.
Convenience APIs
This wrapper also has some convenience APIs that make getting information easier.
This is also a work in progress, and probably will be built out separately.
Installation
Install poetry and bbrest
```bash
$ poetry init
$ poetry add bbrest
This will create a virtual environment with python 3 and the dependencies of this project
```
Install and run JupyterLab
bash
$ poetry add --dev jupyterlab
$ poetry run jupyter lab
Usage
Setup
The key and secret are from your registration on developer.blackboard.com.
The url is the base url for your campus ie: https://blackboard.school.edu
python
from bbrest import BbRest
bb = BbRest(key, secret, url)
Session Management
python
bb.expiration()
'6 minutes ago'
python
r = bb.GetUser(userId='test_user')
r.status_code
200
The call method checks if the session is expired, and renews the token if so. Other methods around token management:
python
r = bb.is_expired() #returns boolean
r = bb.refresh_token() #manually refreshes the token
Note, refresh_token will receive the same token from Blackboard if the token is not yet expired, even if there's only seconds left.
REST call discovery / usage with Tab completion
Find all endpoints available in the current version that have 'GetUs' in the name.
python
r = bb.GetUs<Tab>
* bb.GetUser
* bb.GetUserGrades
* bb.GetUserMemberships
* bb.GetUsers
Find the parameters of 'GetColumnGrade'
python
r = bb.GetColumnGrade(<Shift-Tab>)
* columnId=
* courseId=
* userId=
All available endpoints can be accessed this way.
Params should be entered as params={'key':'value'}
Payload should be entered as payload={'key1':'value1','key2':'value2', etc}
Calling API endpoints
```python
Some convenience tricks for common calls
r = bb.GetCourse(courseId='2832102')
same as above
r = bb.call('GetCourse',courseId='courseId:2832102')
r.json()
r = bb.UpdateCourseMembership(courseId='2832102',
userId='test_user',
payload={'availability':{'available':'No'}})
same as above
r = bb.call('UpdateCourseMembership',courseId='courseId:2832102',userId='userName:test_user',payload={'availability':{'available':'No'}})
r.json()
```
Asynchronous calls!
One of the big advantages of javascript over python was the idea of promises and asynchronous information gathering. Python now has await and async capabilities, but using it can be tricky.
I've tried to make using it with BbRest to be as easy as possible.
python
user_info = await bb.GetUser('test_user', sync=False)
NOTE: Based on how this is setup - you get back a dict object on success or failure. The failure has a status, but the success only has the info. This is slightly different than how it works synchronously, and has the potential to cause logic errors in the code.
Here's an example of multiple calls:
```python
Assume users is a list of userNames
tasks = []
for user in users:
tasks.append(bb.GetUser(user), sync=False)
resps = await asynchio.gather(*tasks)
```
Since these calls are asynchronous, it's MUCH faster than synchronously going through all users.
Working on
[x] Matching up the responses of Async and Sync functions (This is in place as of 3.7)
[ ] Better exception handling, and a way to view failure history.
[x] Calls will always be authenticated, if the session is expired, it will renew the session.
Issues
opened on 2022-12-08 02:54:11 by dependabot[bot]
Bumps certifi from 2020.6.20 to 2022.12.7.
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/mdeakyne/BbRest/network/alerts).
opened on 2022-07-29 23:32:12 by dependabot[bot]
Bumps mistune from 0.8.4 to 2.0.3.
Release notes
Sourced from mistune's releases.
Version 2.0.2
Fix escape_url
via lepture/mistune#295
Version 2.0.1
Fix XSS for image link syntax.
Version 2.0.0
First release of Mistune v2.
Version 2.0.0 RC1
In this release, we have a Security Fix for harmful links.
Version 2.0.0 Alpha 1
This is the first release of v2. An alpha version for users to have a preview of the new mistune.
Changelog
Sourced from mistune's changelog.
Changelog
Here is the full history of mistune v2.
Version 2.0.4
Released on Jul 15, 2022
- Fix
url
plugin in <a>
tag
- Fix
*
formatting
Version 2.0.3
Released on Jun 27, 2022
- Fix
table
plugin
- Security fix for CVE-2022-34749
Version 2.0.2
Released on Jan 14, 2022
Fix escape_url
Version 2.0.1
Released on Dec 30, 2021
XSS fix for image link syntax.
Version 2.0.0
Released on Dec 5, 2021
This is the first non-alpha release of mistune v2.
Version 2.0.0rc1
Released on Feb 16, 2021
Version 2.0.0a6
</tr></table>
... (truncated)
Commits
3f422f1
Version bump 2.0.3
a6d4321
Fix asteris emphasis regex CVE-2022-34749
5638e46
Merge pull request #307 from jieter/patch-1
0eba471
Fix typo in guide.rst
61e9337
Fix table plugin
76dec68
Add documentation for renderer heading when TOC enabled
799cd11
Version bump 2.0.2
babb0cf
Merge pull request #295 from dairiki/bug.escape_url
fc2cd53
Make mistune.util.escape_url less aggressive
3e8d352
Version bump 2.0.1
- Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/mdeakyne/BbRest/network/alerts).
opened on 2022-07-06 21:16:04 by dependabot[bot]
Bumps lxml from 4.6.5 to 4.9.1.
Changelog
Sourced from lxml's changelog.
4.9.1 (2022-07-01)
Bugs fixed
- A crash was resolved when using
iterwalk()
(or canonicalize()
)
after parsing certain incorrect input. Note that iterwalk()
can crash
on valid input parsed with the same parser after failing to parse the
incorrect input.
4.9.0 (2022-06-01)
Bugs fixed
- GH#341: The mixin inheritance order in
lxml.html
was corrected.
Patch by xmo-odoo.
Other changes
-
Built with Cython 0.29.30 to adapt to changes in Python 3.11 and 3.12.
-
Wheels include zlib 1.2.12, libxml2 2.9.14 and libxslt 1.1.35
(libxml2 2.9.12+ and libxslt 1.1.34 on Windows).
-
GH#343: Windows-AArch64 build support in Visual Studio.
Patch by Steve Dower.
4.8.0 (2022-02-17)
Features added
-
GH#337: Path-like objects are now supported throughout the API instead of just strings.
Patch by Henning Janssen.
-
The ElementMaker
now supports QName
values as tags, which always override
the default namespace of the factory.
Bugs fixed
- GH#338: In lxml.objectify, the XSI float annotation "nan" and "inf" were spelled in
lower case, whereas XML Schema datatypes define them as "NaN" and "INF" respectively.
... (truncated)
Commits
d01872c
Prevent parse failure in new test from leaking into later test runs.
d65e632
Prepare release of lxml 4.9.1.
86368e9
Fix a crash when incorrect parser input occurs together with usages of iterwa...
50c2764
Delete unused Travis CI config and reference in docs (GH-345)
8f0bf2d
Try to speed up the musllinux AArch64 build by splitting the different CPytho...
b9f7074
Remove debug print from test.
b224e0f
Try to install 'xz' in wheel builds, if available, since it's now needed to e...
897ebfa
Update macOS deployment target version from 10.14 to 10.15 since 10.14 starts...
853c9e9
Prepare release of 4.9.0.
d3f77e6
Add a test for https://bugs.launchpad.net/lxml/+bug/1965070 leaving out the a...
- Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/mdeakyne/BbRest/network/alerts).
opened on 2022-04-06 19:35:55 by dependabot[bot]
Bumps notebook from 6.4.1 to 6.4.10.

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/mdeakyne/BbRest/network/alerts).
opened on 2022-01-21 20:46:56 by dependabot[bot]
Bumps ipython from 7.16.1 to 7.16.3.
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/mdeakyne/BbRest/network/alerts).
opened on 2021-12-15 14:06:14 by dependabot[bot]
Bumps bleach from 3.1.5 to 3.3.0.
Changelog
Sourced from bleach's changelog.
Version 3.3.0 (February 1st, 2021)
Backwards incompatible changes
- clean escapes HTML comments even when strip_comments=False
Security fixes
- Fix bug 1621692 / GHSA-m6xf-fq7q-8743. See the advisory for details.
Features
None
Bug fixes
None
Version 3.2.3 (January 26th, 2021)
Security fixes
None
Features
None
Bug fixes
- fix clean and linkify raising ValueErrors for certain inputs. Thank you
@Google-Autofuzz
.
Version 3.2.2 (January 20th, 2021)
Security fixes
None
Features
- Migrate CI to Github Actions. Thank you
@hugovk
.
Bug fixes
Version 3.2.1 (September 18th, 2020)
... (truncated)
Commits
79b7a3c
Merge pull request from GHSA-vv2x-vrpj-qqpq
842fcb4
Update for v3.3.0 release
1334134
sanitizer: escape HTML comments
c045a8b
Merge pull request #581 from mozilla/nit-fixes
491abb0
fix typo s/vnedoring/vendoring/
10b1c5d
vendor: add html5lib-1.1.dist-info/REQUESTED
cd838c3
Merge pull request #579 from mozilla/validate-convert-entity-code-points
612b808
Update for v3.2.3 release
6879f6a
html5lib_shim: validate unicode points for convert_entity
90cb80b
Update for v3.2.2 release
- Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/mdeakyne/BbRest/network/alerts).