def submit(self, probNum, path=".", language=None):
"""
submits the problem according to the problem Number of the question.
returns a list containing the submission details about the question.
"""
file_path, filename = UvaSession.find_file(probNum, path)
probFile = open(file_path)
if language is None:
language_number = UvaSession.find_language(filename)
else:
language_number = UvaSession.language_handler[language]
if language_number is None:
return
payload = {
"localid": probNum,
"code": probFile.read(),
"language": language_number,
"codeupl": "",
"problemid": "",
"category": "",
"submit": "Submit"
}
updated_headers = {
"Referer": UvaSession.UVA_HOST + "index.php?option=com_onlinejudge&Itemid=25",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Host": "uva.onlinejudge.org",
"Origin": UvaSession.UVA_HOST
}
resp = self.uva_session.post(UvaSession.SUBMIT_PATH, data=payload, headers=updated_headers)
submission_id = resp.url[resp.url.find('ID')+3:]
return self.check_result(submission_id, probNum)
评论列表
文章目录