#!/usr/bin/env python # -*- coding: utf-8 -*- # # libSIIAU.py # # Copyright 2017 ImNotRoot # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # # #from commands import getoutput, getstatusoutput from requests import get, post import sys, time, os class AuthenticationError(BaseException): def __init__(self, message): self.message = message super(AuthenticationError, self).__init__(message) class Alumno: __UA="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" __URL="http://siiauescolar.siiau.udg.mx" __headers = { 'User-Agent': __UA, } __COOKIES="" __majrp="" codigo="" nip="" nombre="" items=[] carreras=[] valido=True pidm="" def __getCarreras(self,url): #cmd="curl -L -b cookies.txt -i -A '"+self.__UA+"' -X GET '"+self.__URL+""+url+"'" r=get(self.__URL+""+url,headers=self.__headers,cookies=self.__COOKIES) #out=getoutput(cmd) out=r.text if("OPTION" in out): cab='