PageRenderTime 23ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/boto-2.5.2/tests/mturk/create_hit_with_qualifications.py

#
Python | 16 lines | 14 code | 2 blank | 0 comment | 1 complexity | f3587b06df6dc356ae999e7ce7f13ea0 MD5 | raw file
 1from boto.mturk.connection import MTurkConnection
 2from boto.mturk.question import ExternalQuestion
 3from boto.mturk.qualification import Qualifications, PercentAssignmentsApprovedRequirement
 4
 5def test():
 6    q = ExternalQuestion(external_url="http://websort.net/s/F3481C", frame_height=800)
 7    conn = MTurkConnection(host='mechanicalturk.sandbox.amazonaws.com')
 8    keywords=['boto', 'test', 'doctest']
 9    qualifications = Qualifications()
10    qualifications.add(PercentAssignmentsApprovedRequirement(comparator="GreaterThan", integer_value="95"))
11    create_hit_rs = conn.create_hit(question=q, lifetime=60*65, max_assignments=2, title="Boto External Question Test", keywords=keywords, reward = 0.05, duration=60*6, approval_delay=60*60, annotation='An annotation from boto external question test', qualifications=qualifications)
12    assert(create_hit_rs.status == True)
13    print create_hit_rs.HITTypeId
14
15if __name__ == "__main__":
16    test()