Sync API Reference

BlackboardSync

BlackboardSync.

Automatically sync content from Blackboard

class blackboard_sync.sync.BlackboardSync[source]

Represents an instance of the BlackboardSync application.

Create an instance of the program.

_sync_task() None[source]

Constantly check if the data is outdated and if so start a download job.

Method run by Sync thread.

auth(cookie_jar: RequestsCookieJar) bool[source]

Create a new Blackboard session with the given credentials.

Will start syncing automatically if login successful.

Parameters:

persistence (bool) – If true, login will be saved in the OS designated keyring.

change_download_location(new_dir: Path, redownload: bool = False) None[source]

Set new sync location.

Parameters:
  • dir (Path) – The path of the sync dir.

  • redownload (bool) – If true, ALL content will be re-downloaded to the new location.

property download_location: Path

Location to where all Blackboard content will be downloaded.

force_sync() None[source]

Force Sync thread to start download job ASAP.

property has_error: bool

Flag indicates an error resulting in no downloads.

property is_active: bool

Indicate the state of the sync thread.

property is_logged_in: bool

Indicate if a user session is currently active.

property is_syncing: bool

Flag raised everytime a download job is running.

property last_sync_time: datetime | None

Datetime right before last download job started.

log_out() None[source]

Stop syncing and forget user session.

property logger: Logger

Logger for BlackboardSync, set at level WARN.

property min_year: int
property next_sync: datetime

Time when last sync will be outdated.

property outdated: bool

Return true if last download job is outdated.

setup(university_index: int, download_location: Path, min_year: int | None = None) None[source]

Setup the university information.

start_sync() bool[source]

Starts Sync thread or returns False if not possible.

stop_sync() None[source]

Stop Sync thread.

property sync_interval: int

Time to wait between download jobs.

property university_index
property username: str | None

BlackboardDownload

BlackboardDownload, mass download all user content from Blackboard

class blackboard_sync.download.BlackboardDownload(sess: BlackboardSession, download_location: Path, last_downloaded: datetime | None = None, data_sources: list[str] = [], min_year: int | None = None)[source]

Blackboard download job.

BlackboardDownload constructor

Download all files in blackboard recursively to download_location, only if they have been altered since specified datetime

Keyword arguments:

Parameters:
  • sess (BlackboardSession) – UCLan BB user session

  • download_location ((str / Path)) – Where files will be stored

  • last_downloaded (str) – Files modified before this will not be downloaded

  • data_sources – List of valid data sources

  • min_year – Only courses created on or after this year will be downloaded

Creates a platform-aware internet shortcut

_handle_file(content: BBCourseContent, parent_path: Path, course_id: str, depth: int = 0) None[source]

Download BBContent recursively, depending on filetype

cancel() None[source]

Cancel the download job.

property data_sources: list[str]

Filter for courses.

download() datetime | None[source]

Retrieve the user’s courses, and start download of all contents

Returns:

Datetime when method was called.

property download_location: Path

The location where files will be downloaded to.

property files_processed: int

Number of files that have been downloaded.

property logger: Logger

Logger for BlackboardDownload, set at level DEBUG.

property user_id: str

User ID used for API calls.