HTMLify
ticket.py
Views: 620 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 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 |