Skip to content
Snippets Groups Projects
Commit 486f5131 authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

remove unnecessary post data and requests

parent 9b1a8e09
No related branches found
No related tags found
No related merge requests found
......@@ -31,47 +31,29 @@ import_url = host + "ilias/ilias.php?ref_id=65&cmd=post&cmdClass=ilobjquestionpo
confirm_url = host + "ilias/ilias.php?ref_id=65&cmd=post&cmdClass=ilobjquestionpoolgui&cmdNode=26:gb&baseClass=ilRepositoryGUI&rtoken=fd2f3337a6d4ae0689b5163d6af186a9"
import_data = {
"title" : "",
"description" : "",
"author" : "",
"type" : "",
"tblfsqpl_qst_brows_65[]" : "description",
"tblfsqpl_qst_brows_65[]" : "type",
"tblfsqpl_qst_brows_65[]" : "points",
"tblfsqpl_qst_brows_65[]" : "statistics",
"tblfsqpl_qst_brows_65[]" : "author",
"tblfsqpl_qst_brows_65[]" : "created",
"tblfsqpl_qst_brows_65[]" : "tstamp",
"tblfsqpl_qst_brows_65[]" : "working_time",
"tblfshqpl_qst_brows_65" : "1",
"cmd[importQuestions]" : "Import",
}
confirm_data = {
"qpl_new" : "",
"ident[]" : "undefined", # this has to be based on the number of questions
"cmd[importVerifiedFile]" : "Import",
"questions_only" : "1",
}
def send_script(filepath):
m = MultipartEncoder(fields={
file = MultipartEncoder(fields={
'xmldoc': (
os.path.basename(filepath),
open(filepath, 'r', encoding='utf-8').read(),
open(filepath, 'rb'),
'text/xml'
),
'ilfilehash': 'Is not validated suckers',
'cmd[upload]': 'Upload',
)
})
# session create and login
session = requests.Session()
r = session.post(host + "ilias/login.php", data=login)
r = session.get("http://192.168.1.2/ilias/ilias.php?ref_id=65&cmd=questions&cmdClass=ilobjquestionpoolgui&cmdNode=26:gb&baseClass=ilRepositoryGUI&ref_id=65")
r = session.post(import_url, data=import_data)
r = session.post(upload_url, data=m, headers={'Content-Type': m.content_type})
r = session.post(upload_url, data=file, headers={'Content-Type': file.content_type})
r = session.post(confirm_url, data=confirm_data)
return r.status_code == 500
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment