Search is not available for this dataset
text stringlengths 75 104k |
|---|
def get_enrollments_for_section(self, section_id, params={}):
"""
Return a list of all enrollments for the passed section_id.
https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index
"""
url = SECTIONS_API.format(section_id) + "/enrollments"
... |
def get_enrollments_for_section_by_sis_id(self, sis_section_id, params={}):
"""
Return a list of all enrollments for the passed section sis id.
"""
return self.get_enrollments_for_section(
self._sis_id(sis_section_id, sis_field="section"), params) |
def get_enrollments_for_regid(self, regid, params={},
include_courses=True):
"""
Return a list of enrollments for the passed user regid.
https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index
"""
sis_user_id = self.... |
def enroll_user(self, course_id, user_id, enrollment_type, params=None):
"""
Enroll a user into a course.
https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.create
"""
url = COURSES_API.format(course_id) + "/enrollments"
if not params:
... |
def capacity_vesics_1975(sl, fd, h_l=0, h_b=0, vertical_load=1, slope=0, base_tilt=0, verbose=0, gwl=1e6, **kwargs):
"""
Calculates the foundation capacity according Vesics(1975)
#Gunaratne, Manjriker. 2006. "Spread Footings: Analysis and Design."
Ref: http://geo.cv.nctu.edu.tw/foundation/download/
... |
def capacity_terzaghi_1943(sl, fd, round_footing=False, verbose=0, **kwargs):
"""
Calculates the foundation capacity according Terzaghi (1943)
Ref: http://geo.cv.nctu.edu.tw/foundation/
download/BearingCapacityOfFoundations.pdf
:param sl: Soil object
:param fd: Foundation object
:param roun... |
def capacity_hansen_1970(sl, fd, h_l=0, h_b=0, vertical_load=1, slope=0, base_tilt=0, verbose=0, **kwargs):
"""
Calculates the foundation capacity according Hansen (1970)
Ref: http://bestengineeringprojects.com/civil-projects/
hansens-bearing-capacity-theory/
:param sl: Soil object
:param fd: F... |
def capacity_meyerhof_1963(sl, fd, gwl=1e6, h_l=0, h_b=0, vertical_load=1, verbose=0, **kwargs):
"""
Calculates the foundation capacity according Meyerhoff (1963)
http://www.engs-comp.com/meyerhof/index.shtml
:param sl: Soil object
:param fd: Foundation object
:param h_l: Horizontal load parall... |
def capacity_nzs_vm4_2011(sl, fd, h_l=0, h_b=0, vertical_load=1, slope=0, verbose=0, **kwargs):
"""
calculates the capacity according to
Appendix B verification method 4 of the NZ building code
:param sl: Soil object
:param fd: Foundation object
:param h_l: Horizontal load parallel to length
... |
def capacity_salgado_2008(sl, fd, h_l=0, h_b=0, vertical_load=1, verbose=0, **kwargs):
"""
calculates the capacity according to
THe Engineering of Foundations textbook by Salgado
ISBN: 0072500581
:param sl: Soil object
:param fd: Foundation object
:param h_l: Horizontal load parallel to ... |
def size_footing_for_capacity(sl, vertical_load, fos=1.0, length_to_width=1.0, verbose=0, **kwargs):
"""
Determine the size of a footing given an aspect ratio and a load
:param sl: Soil object
:param vertical_load: The applied load to the foundation
:param fos: The target factor of safety
:param... |
def capacity_method_selector(sl, fd, method, **kwargs):
"""
Calculates the bearing capacity of a foundation on soil using the specified method.
:param sl: Soil Object
:param fd: Foundation Object
:param method: Method
:param kwargs:
:return:
"""
if method == 'vesics':
capaci... |
def deprecated_capacity_meyerhof_and_hanna_1978(sl_0, sl_1, h0, fd, verbose=0):
"""
Calculates the two-layered foundation capacity according Meyerhof and Hanna (1978)
:param sl_0: Top Soil object
:param sl_1: Base Soil object
:param h0: Height of top soil layer
:param fd: Foundation object
... |
def capacity_meyerhof_and_hanna_1978(sl_0, sl_1, h0, fd, gwl=1e6, verbose=0):
"""
Calculates the two-layered foundation capacity according Meyerhof and Hanna (1978)
:param sl_0: Top Soil object
:param sl_1: Base Soil object
:param h0: Height of top soil layer
:param fd: Foundation object
:p... |
def capacity_sp_meyerhof_and_hanna_1978(sp, fd, verbose=0):
"""
Calculates the two-layered foundation capacity according Meyerhof and Hanna (1978)
:param sp: Soil profile object
:param fd: Foundation object
:param wtl: water table level
:param verbose: verbosity
:return: ultimate bearing st... |
def get_roles_in_account(self, account_id, params={}):
"""
List the roles for an account, for the passed Canvas account ID.
https://canvas.instructure.com/doc/api/roles.html#method.role_overrides.api_index
"""
url = ACCOUNTS_API.format(account_id) + "/roles"
roles = []
... |
def get_roles_by_account_sis_id(self, account_sis_id, params={}):
"""
List the roles for an account, for the passed account SIS ID.
"""
return self.get_roles_in_account(self._sis_id(account_sis_id,
sis_field="account"),
... |
def get_effective_course_roles_in_account(self, account_id):
"""
List all course roles available to an account, for the passed Canvas
account ID, including course roles inherited from parent accounts.
"""
course_roles = []
params = {"show_inherited": "1"}
for role... |
def get_role(self, account_id, role_id):
"""
Get information about a single role, for the passed Canvas account ID.
https://canvas.instructure.com/doc/api/roles.html#method.role_overrides.show
"""
url = ACCOUNTS_API.format(account_id) + "/roles/{}".format(role_id)
return... |
def get_role_by_account_sis_id(self, account_sis_id, role_id):
"""
Get information about a single role, for the passed account SIS ID.
"""
return self.get_role(self._sis_id(account_sis_id, sis_field="account"),
role_id) |
def get_course(self, course_id, params={}):
"""
Return course resource for given canvas course id.
https://canvas.instructure.com/doc/api/courses.html#method.courses.show
"""
include = params.get("include", [])
if "term" not in include:
include.append("term")... |
def get_course_by_sis_id(self, sis_course_id, params={}):
"""
Return course resource for given sis id.
"""
return self.get_course(self._sis_id(sis_course_id, sis_field="course"),
params) |
def get_courses_in_account(self, account_id, params={}):
"""
Returns a list of courses for the passed account ID.
https://canvas.instructure.com/doc/api/accounts.html#method.accounts.courses_api
"""
if "published" in params:
params["published"] = "true" if params["pu... |
def get_courses_in_account_by_sis_id(self, sis_account_id, params={}):
"""
Return a list of courses for the passed account SIS ID.
"""
return self.get_courses_in_account(
self._sis_id(sis_account_id, sis_field="account"), params) |
def get_published_courses_in_account(self, account_id, params={}):
"""
Return a list of published courses for the passed account ID.
"""
params["published"] = True
return self.get_courses_in_account(account_id, params) |
def get_published_courses_in_account_by_sis_id(self, sis_account_id,
params={}):
"""
Return a list of published courses for the passed account SIS ID.
"""
return self.get_published_courses_in_account(
self._sis_id(sis_accoun... |
def get_courses_for_regid(self, regid, params={}):
"""
Return a list of courses for the passed regid.
https://canvas.instructure.com/doc/api/courses.html#method.courses.index
"""
self._as_user = regid
data = self._get_resource("/api/v1/courses", params=params)
se... |
def create_course(self, account_id, course_name):
"""
Create a canvas course with the given subaccount id and course name.
https://canvas.instructure.com/doc/api/courses.html#method.courses.create
"""
url = ACCOUNTS_API.format(account_id) + "/courses"
body = {"course": {... |
def update_sis_id(self, course_id, sis_course_id):
"""
Updates the SIS ID for the course identified by the passed course ID.
https://canvas.instructure.com/doc/api/courses.html#method.courses.update
"""
url = COURSES_API.format(course_id)
body = {"course": {"sis_course_i... |
def get_activity_by_account(self, account_id, term_id):
"""
Returns participation data for the given account_id and term_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_participation
"""
url = ("/api/v1/accounts/sis_account_id:%s/analyti... |
def get_grades_by_account(self, account_id, term_id):
"""
Returns grade data for the given account_id and term_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_grades
"""
url = ("/api/v1/accounts/sis_account_id:%s/analytics/"
... |
def get_statistics_by_account(self, account_id, term_id):
"""
Returns statistics for the given account_id and term_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_statistics
"""
url = ("/api/v1/accounts/sis_account_id:%s/analytics/"
... |
def get_activity_by_sis_course_id(self, sis_course_id):
"""
Returns participation data for the given sis_course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_participation
"""
url = "/api/v1/courses/%s/analytics/activity.json" % (
... |
def get_assignments_by_sis_course_id(self, sis_course_id):
"""
Returns assignment data for the given course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_assignments
"""
url = "/api/v1/courses/%s/analytics/assignments.json" % (
... |
def get_student_summaries_by_sis_course_id(self, sis_course_id):
"""
Returns per-student data for the given course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.course_student_summaries
"""
url = "/api/v1/courses/%s/analytics/student_summaries.js... |
def get_student_activity_for_sis_course_id_and_sis_user_id(
self, sis_user_id, sis_course_id):
"""
Returns student activity data for the given user_id and course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.student_in_course_participation
""... |
def get_student_assignments_for_sis_course_id_and_sis_user_id(
self, sis_user_id, sis_course_id):
"""
Returns student assignment data for the given user_id and course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.student_in_course_assignments
... |
def get_student_assignments_for_sis_course_id_and_canvas_user_id(
self, sis_course_id, user_id):
"""
Returns student assignment data for the given user_id and course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.student_in_course_assignments
... |
def get_student_messaging_for_sis_course_id_and_sis_user_id(
self, sis_user_id, sis_course_id):
"""
Returns student messaging data for the given user_id and course_id.
https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.student_in_course_messaging
"""
... |
def get_submissions_by_course_and_assignment(
self, course_id, assignment_id, params={}):
"""
https://canvas.instructure.com/doc/api/submissions.html#method.submissions_api.index
"""
url = COURSES_API.format(course_id)
url += "/assignments/{}/submissions".format(assig... |
def get_submissions_multiple_assignments_by_sis_id(
self, is_section, sis_id, students=None, assignments=None,
**params):
"""
List submissions for multiple assignments by course/section sis id and
optionally student
https://canvas.instructure.com/doc/api/submissi... |
def get_submissions_multiple_assignments(
self, is_section, course_id, students=None, assignments=None,
**params):
"""
List submissions for multiple assignments by course/section id and
optionally student
https://canvas.instructure.com/doc/api/submissions.html#me... |
def rotational_stiffness(sl, fd, axis="length", a0=0.0, **kwargs):
"""
Rotation stiffness of foundation.
:param fd: Foundation object
:param sl: Soil Object.
:param axis: The axis which it should be computed around
:return:
"""
if not kwargs.get("disable_requires", False):
gf.mod... |
def get_external_tools_in_account(self, account_id, params={}):
"""
Return external tools for the passed canvas account id.
https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.index
"""
url = ACCOUNTS_API.format(account_id) + "/external_tools"
... |
def get_external_tools_in_course(self, course_id, params={}):
"""
Return external tools for the passed canvas course id.
https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.index
"""
url = COURSES_API.format(course_id) + "/external_tools"
ex... |
def _create_external_tool(self, context, context_id, json_data):
"""
Create an external tool using the passed json_data.
context is either COURSES_API or ACCOUNTS_API.
context_id is the Canvas course_id or account_id, depending on context.
https://canvas.instructure.com/doc/api... |
def _update_external_tool(self, context, context_id, external_tool_id,
json_data):
"""
Update the external tool identified by external_tool_id with the passed
json data.
context is either COURSES_API or ACCOUNTS_API.
context_id is the course_id or a... |
def _delete_external_tool(self, context, context_id, external_tool_id):
"""
Delete the external tool identified by external_tool_id.
context is either COURSES_API or ACCOUNTS_API.
context_id is the course_id or account_id, depending on context
https://canvas.instructure.com/doc... |
def _get_sessionless_launch_url(self, context, context_id, tool_id):
"""
Get a sessionless launch url for an external tool.
https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.generate_sessionless_launch
"""
url = context.format(context_id) + "/exter... |
def get_sessionless_launch_url_from_account_sis_id(
self, tool_id, account_sis_id):
"""
Get a sessionless launch url for an external tool.
https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.generate_sessionless_launch
"""
return self.get... |
def get_sessionless_launch_url_from_course_sis_id(
self, tool_id, course_sis_id):
"""
Get a sessionless launch url for an external tool.
https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.generate_sessionless_launch
"""
return self.get_s... |
def create_foundation(length, width, depth=0.0, height=0.0):
"""
Can define a Foundation Object from dimensions.
:param length: Foundation length
:param width: Foundation width
:param depth: Foundation depth
:param height: Foundation height
:return: A Foundation object
"""
a_foundati... |
def create_soil(phi=0.0, cohesion=0.0, unit_dry_weight=0.0, pw=9800):
"""
Can define a Soil object.
:param phi: Internal friction angle
:param cohesion: Cohesion of soil
:param unit_dry_weight: The dry unit weight of the soil.
:param pw: specific weight of water
:return: A Soil object.
"... |
def check_required(obj, required_parameters):
"""
Check if a parameter is available on an object
:param obj: Object
:param required_parameters: list of parameters
:return:
"""
for parameter in required_parameters:
if not hasattr(obj, parameter) or getattr(obj, parameter) is None:
... |
def get_user(self, user_id):
"""
Returns user profile data.
https://canvas.instructure.com/doc/api/users.html#method.profile.settings
"""
url = USERS_API.format(user_id) + "/profile"
return CanvasUser(data=self._get_resource(url)) |
def get_users_for_course(self, course_id, params={}):
"""
Returns a list of users for the given course id.
"""
url = COURSES_API.format(course_id) + "/users"
data = self._get_paged_resource(url, params=params)
users = []
for datum in data:
users.append... |
def get_users_for_sis_course_id(self, sis_course_id, params={}):
"""
Returns a list of users for the given sis course id.
"""
return self.get_users_for_course(
self._sis_id(sis_course_id, sis_field="course"), params) |
def create_user(self, user, account_id=None):
"""
Create and return a new user and pseudonym for an account.
https://canvas.instructure.com/doc/api/users.html#method.users.create
"""
if account_id is None:
account_id = self._canvas_account_id
if account_i... |
def get_user_logins(self, user_id, params={}):
"""
Return a user's logins for the given user_id.
https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.index
"""
url = USERS_API.format(user_id) + "/logins"
data = self._get_paged_resource(url, params=params... |
def update_user_login(self, login, account_id=None):
"""
Update an existing login for a user in the given account.
https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.update
"""
if account_id is None:
account_id = self._canvas_account_id
... |
def _next_page(self, response):
"""
return url path to next page of paginated data
"""
for link in response.getheader("link", "").split(","):
try:
(url, rel) = link.split(";")
if "next" in rel:
return url.lstrip("<").rstrip(... |
def _get_resource_url(self, url, auto_page, data_key):
"""
Canvas GET method on a full url. Return representation of the
requested resource, chasing pagination links to coalesce resources
if indicated.
"""
headers = {'Accept': 'application/json',
'Conne... |
def _get_paged_resource(self, url, params=None, data_key=None):
"""
Canvas GET method. Return representation of the requested paged
resource, either the requested page, or chase pagination links to
coalesce resources.
"""
if not params:
params = {}
se... |
def _get_resource(self, url, params=None, data_key=None):
"""
Canvas GET method. Return representation of the requested resource.
"""
if not params:
params = {}
self._set_as_user(params)
full_url = url + self._params(params)
return self._get_resourc... |
def _put_resource(self, url, body):
"""
Canvas PUT method.
"""
params = {}
self._set_as_user(params)
headers = {'Content-Type': 'application/json',
'Accept': 'application/json',
'Connection': 'keep-alive'}
url = url + self._pa... |
def _post_resource(self, url, body):
"""
Canvas POST method.
"""
params = {}
self._set_as_user(params)
headers = {'Content-Type': 'application/json',
'Accept': 'application/json',
'Connection': 'keep-alive'}
url = url + self._... |
def _delete_resource(self, url):
"""
Canvas DELETE method.
"""
params = {}
self._set_as_user(params)
headers = {'Accept': 'application/json',
'Connection': 'keep-alive'}
url = url + self._params(params)
response = DAO.deleteURL(url, head... |
def get_admins(self, account_id, params={}):
"""
Return a list of the admins in the account.
https://canvas.instructure.com/doc/api/admins.html#method.admins.index
"""
url = ADMINS_API.format(account_id)
admins = []
for data in self._get_paged_resource(url, para... |
def create_admin(self, account_id, user_id, role):
"""
Flag an existing user as an admin within the account.
https://canvas.instructure.com/doc/api/admins.html#method.admins.create
"""
url = ADMINS_API.format(account_id)
body = {"user_id": unquote(str(user_id)),
... |
def create_admin_by_sis_id(self, sis_account_id, user_id, role):
"""
Flag an existing user as an admin within the account sis id.
"""
return self.create_admin(self._sis_id(sis_account_id), user_id, role) |
def delete_admin(self, account_id, user_id, role):
"""
Remove an account admin role from a user.
https://canvas.instructure.com/doc/api/admins.html#method.admins.destroy
"""
url = ADMINS_API.format(account_id) + "/{}?role={}".format(
user_id, quote(role))
re... |
def delete_admin_by_sis_id(self, sis_account_id, user_id, role):
"""
Remove an account admin role from a user for the account sis id.
"""
return self.delete_admin(self._sis_id(sis_account_id), user_id, role) |
def get_grading_standards_for_course(self, course_id):
"""
List the grading standards available to a course
https://canvas.instructure.com/doc/api/grading_standards.html#method.grading_standards_api.context_index
"""
url = COURSES_API.format(course_id) + "/grading_standards"
... |
def create_grading_standard_for_course(self, course_id, name,
grading_scheme, creator):
"""
Create a new grading standard for the passed course.
https://canvas.instructure.com/doc/api/grading_standards.html#method.grading_standards_api.create
"... |
def get_section(self, section_id, params={}):
"""
Return section resource for given canvas section id.
https://canvas.instructure.com/doc/api/sections.html#method.sections.show
"""
url = SECTIONS_API.format(section_id)
return CanvasSection(data=self._get_resource(url, pa... |
def get_section_by_sis_id(self, sis_section_id, params={}):
"""
Return section resource for given sis id.
"""
return self.get_section(
self._sis_id(sis_section_id, sis_field="section"), params) |
def get_sections_in_course(self, course_id, params={}):
"""
Return list of sections for the passed course ID.
https://canvas.instructure.com/doc/api/sections.html#method.sections.index
"""
url = COURSES_API.format(course_id) + "/sections"
sections = []
for data ... |
def get_sections_in_course_by_sis_id(self, sis_course_id, params={}):
"""
Return list of sections for the passed course SIS ID.
"""
return self.get_sections_in_course(
self._sis_id(sis_course_id, sis_field="course"), params) |
def get_sections_with_students_in_course(self, course_id, params={}):
"""
Return list of sections including students for the passed course ID.
"""
include = params.get("include", [])
if "students" not in include:
include.append("students")
params["include"] = ... |
def get_sections_with_students_in_course_by_sis_id(self, sis_course_id,
params={}):
"""
Return list of sections including students for the passed sis ID.
"""
return self.get_sections_with_students_in_course(
self._sis_id(... |
def create_section(self, course_id, name, sis_section_id):
"""
Create a canvas section in the given course id.
https://canvas.instructure.com/doc/api/sections.html#method.sections.create
"""
url = COURSES_API.format(course_id) + "/sections"
body = {"course_section": {"na... |
def update_section(self, section_id, name, sis_section_id):
"""
Update a canvas section with the given section id.
https://canvas.instructure.com/doc/api/sections.html#method.sections.update
"""
url = SECTIONS_API.format(section_id)
body = {"course_section": {}}
... |
def get_quizzes(self, course_id):
"""
List quizzes for a given course
https://canvas.instructure.com/doc/api/quizzes.html#method.quizzes_api.index
"""
url = QUIZZES_API.format(course_id)
data = self._get_resource(url)
quizzes = []
for datum in data:
... |
def get_account(self, account_id):
"""
Return account resource for given canvas account id.
https://canvas.instructure.com/doc/api/accounts.html#method.accounts.show
"""
url = ACCOUNTS_API.format(account_id)
return CanvasAccount(data=self._get_resource(url)) |
def get_sub_accounts(self, account_id, params={}):
"""
Return list of subaccounts within the account with the passed
canvas id.
https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts
"""
url = ACCOUNTS_API.format(account_id) + "/sub_accounts"
... |
def update_account(self, account):
"""
Update the passed account. Returns the updated account.
https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update
"""
url = ACCOUNTS_API.format(account.account_id)
body = {"account": {"name": account.name}}
... |
def update_sis_id(self, account_id, sis_account_id):
"""
Updates the SIS ID for the account identified by the passed account ID.
https://canvas.instructure.com/doc/api/accounts.html#method.accounts.update
"""
if account_id == self._canvas_account_id:
raise Exception(... |
def get_auth_settings(self, account_id):
"""
Return the authentication settings for the passed account_id.
https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show_sso_settings
"""
url = ACCOUNTS_API.format(account_id) + "/ss... |
def update_auth_settings(self, account_id, auth_settings):
"""
Update the authentication settings for the passed account_id.
https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.update_sso_settings
"""
url = ACCOUNTS_API.forma... |
def settlement_schmertmann(sp, fd, load, youngs_modulus_soil, **kwargs):
"""
Calculates the settlement of a shallow foundation (Schmertmann, 19XX).
:param sp: Soil Profile object
:param fd: Foundation object
:param load:
:param youngs_modulus_soil: The Young's modulus of the soil.
:param kw... |
def get_all_terms(self):
"""
Return all of the terms in the account.
https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index
"""
if not self._canvas_account_id:
raise MissingAccountID()
params = {"workflow_state": 'all', 'per_page'... |
def get_term_by_sis_id(self, sis_term_id):
"""
Return a term resource for the passed SIS ID.
"""
for term in self.get_all_terms():
if term.sis_term_id == sis_term_id:
return term |
def update_term_overrides(self, sis_term_id, overrides={}):
"""
Update an existing enrollment term for the passed SIS ID.
https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms.update
"""
if not self._canvas_account_id:
raise MissingAccountID()
... |
def log(out_str, o2="", o3="", o4=""):
"""
Produces console output.
:param out_str: Output string
:param o2: Additional output string
:param o3: Additional output string
:param o4: Additional output string
:return: None
"""
print(out_str, o2, o3, o4) |
def import_str(self, csv, params={}):
"""
Imports a CSV string.
https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create
"""
if not self._canvas_account_id:
raise MissingAccountID()
params["import_type"] = SISImportModel.CSV_IMPO... |
def import_dir(self, dir_path, params={}):
"""
Imports a directory of CSV files.
https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create
"""
if not self._canvas_account_id:
raise MissingAccountID()
body = self._build_archive(dir... |
def get_import_status(self, sis_import):
"""
Get the status of an already created SIS import.
https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.show
"""
if not self._canvas_account_id:
raise MissingAccountID()
url = SIS_IMPORTS_A... |
def _build_archive(self, dir_path):
"""
Creates a zip archive from files in path.
"""
zip_path = os.path.join(dir_path, "import.zip")
archive = zipfile.ZipFile(zip_path, "w")
for filename in CSV_FILES:
filepath = os.path.join(dir_path, filename)
... |
def get_assignments(self, course_id):
"""
List assignments for a given course
https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.index
"""
url = ASSIGNMENTS_API.format(course_id)
data = self._get_resource(url)
assignments = []
... |
def update_assignment(self, assignment):
"""
Modify an existing assignment.
https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.update
"""
url = ASSIGNMENTS_API.format(assignment.course_id) + "/{}".format(
assignment.assignment_id)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.