Python 是否可以使用Blackboard Web服务以编程方式向Blackboard提交作业
有人能确认是否可以使用Blackboard Web服务以编程方式向Blackboard提交作业吗?(如文件所述)。具体来说,我想知道使用Gradebook.WS、AttemptVO和studentSubmission方法提交作业的正确方法。以下是我迄今为止尝试过的内容,主要是在Bb成绩册中可以看到尝试,但attemptVO除外。学生提交在黑板成绩册中不可见:Python 是否可以使用Blackboard Web服务以编程方式向Blackboard提交作业,python,web-services,blackboard,Python,Web Services,Blackboard,有人能确认是否可以使用Blackboard Web服务以编程方式向Blackboard提交作业吗?(如文件所述)。具体来说,我想知道使用Gradebook.WS、AttemptVO和studentSubmission方法提交作业的正确方法。以下是我迄今为止尝试过的内容,主要是在Bb成绩册中可以看到尝试,但attemptVO除外。学生提交在黑板成绩册中不可见: from suds.client import Client from suds.plugin import MessagePlugin
from suds.client import Client
from suds.plugin import MessagePlugin
from suds.wsse import Timestamp, UsernameToken, Security
WS_BASE_URL = 'http://bbdev.bangor.ac.uk/webapps/ws/services/'
class Learn9Plugin(MessagePlugin):
def marshalled(self, context):
password = context.envelope.childAtPath('Header/Security/UsernameToken/Password')
password.set('Type', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText')
security = Security()
security.tokens.append(Timestamp())
security.tokens.append(UsernameToken('session', 'nosession'))
plugin = Learn9Plugin()
context = Client( WS_BASE_URL + 'Context.WS?wsdl',
location = WS_BASE_URL + 'Context.WS',
autoblend = True,
wsse = security,
plugins = [plugin])
context.options.wsse.tokens[1].password = context.service.initialize()
result = context.service.loginTool('xxxxx', 'xxxx', 'xxxxx', '', 500)
course_id = '_15877_1'
gradebook = Client(WS_BASE_URL + 'Gradebook.WS?wsdl',
location=WS_BASE_URL + 'Gradebook.WS',
autoblend=True,
wsse=security,
plugins=[plugin])
attemptVO = gradebook.factory.create('ns0:AttemptVO')
attemptVO.override = False
attemptVO.publicFeedbackToUser = False
attemptVO.score = 0
attemptVO.gradeId = '_169_1' # Smith
attemptVO.studentSubmission = 'Some sample text representing an assignment'
attemptVO.studentSubmissionTextType = 'PLAIN_TEXT'
print attemptVO
attempt_result = gradebook.service.saveAttempts(course_id, [attemptVO,])
print attempt_result
结果:
(AttemptVO){
attemptDate = None
creationDate = None
displayGrade = None
exempt = None
expansionData[] = <empty>
feedbackToUser = None
grade = None
gradeId = "_169_1"
groupAttemptId = None
id = None
instructorNotes = None
override = False
publicFeedbackToUser = False
score = 0
status = None
studentComments = None
studentSubmission = "Some sample text representing an assignment"
studentSubmissionTextType = "PLAIN_TEXT"
}
[_586_1]
(AttemptVO){
attemptDate=None
肌酸盐=无
显示等级=无
豁免=无
扩展数据[]=
反馈器=无
等级=无
gradeId=“\u 169\u 1”
GroupAttempId=None
id=无
说明或说明=无
覆盖=错误
publicFeedbackToUser=错误
分数=0
状态=无
studentComments=无
studentSubmission=“代表作业的一些示例文本”
studentSubmissionTextType=“纯文本”
}
[_586_1]
非常感谢。Blackboard的一位开发人员回复我说,由于“studentSubmission”和“setStudentSubmissionTextType”方法是只读属性,因此无法使用Web服务提交作业
已向Blackboard请求更新文档。不需要更新,因为无法使用上述API。我从来没有检查过文档,看它们是否被更新过。