from requests import get, post
def get_token():
r = get("https://helpdesk.agrauniv.online/Home/NewTicket")
html = r.text
html = html[html.find("__")+49:html.find("__")+204]
token = html
return token
def new_ticket(type=0, subject="", enroll=0, name="", email="", mobile=0, message="", filepaths: ["filepaths"]=[]):
data = {
"CTypeID": type,
"Subject": subject,
"nroll_Roll": enroll,
"Name": name,
"Email": email,
"Mobile": mobile,
"Message": message,
"__RequestVerificationToken": get_token(),
"code": "abhd",
}
files = []
for filepath in filepaths:
files.append(("file", open(filepath, "rb")))
r = post("https://helpdesk.agrauniv.online/Home/NewTicket", data=data, files=files)
html = r.text
html = html[html.find("S-23"):html.find("S-23")+10]
return html
def reply(ticket, message="", filepaths=[]):
data = {
"Ticket": ticket,
"Message": message,
"Status": "Open",
"__RequestVerificationToken": get_token(),
}
files = []
for filepath in filepaths:
files.append(("file", open(filepath, "rb")))
r = post("https://helpdesk.agrauniv.online/Home/Tickets", data=data, files=files)
return r.ok