python - 是否可以使用 Blackboard WebServices 以编程方式将作业提交给 Blackboard

标签 python web-services blackboard

谁能确认是否可以使用 Blackboard WebServices 以编程方式向 Blackboard 提交作业? (如记录 here )。具体来说,我想知道使用 Gradebook.WS、AttemptVO 和 studentSubmission 方法提交作业的正确方法。到目前为止,这是我尝试过的方法,主要是因为尝试可以在 Bb 成绩簿中看到,除了 attemptVO.studentSubmission 在 Blackboard 成绩簿中不可见:

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]

非常感谢。

最佳答案

Blackboard 的一位开发人员回复我说无法使用网络服务提交作业,因为“studentSubmission”和“setStudentSubmissionTextType”方法是只读属性。

已向 Blackboard 提出更新文档的请求。

关于python - 是否可以使用 Blackboard WebServices 以编程方式将作业提交给 Blackboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11455404/

相关文章:

python - Pygame 加载图像

jQuery Ajax 调用 Web 服务,返回未定义

json - RESTful JSON 的链接 header 与链接元素

java - SSH隧道远程访问MySQL数据库

firefox - 黑板标题 : Ok in Chrome and IE8, 在 Firefox 中不稳定

html - 如何使用 HTML 并排放置两个 poll everywhere 元素?

python GUI 与 Swing 相比?

python - 裁剪出字符串的一部分并使用正则表达式打印

python - 搜索具有嵌套值的树结构?

javascript - 如何在不使用 JSON 或任何东西的情况下使用纯 JavaScript/Ajax 调用此 HelloWorld Web 方法?