From dab65ebe11e51c7d32a97086da6fec987892bd2d Mon Sep 17 00:00:00 2001 From: kirbylife Date: Mon, 4 Nov 2019 22:29:44 -0600 Subject: [PATCH] added poetry estructure --- .gitignore | 4 + README.md | 10 +- libSIIAU.py | 477 -------------------------------------- lib_siiau/__init__.py | 1 + lib_siiau/libSIIAU.py | 524 ++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 15 ++ 6 files changed, 548 insertions(+), 483 deletions(-) delete mode 100644 libSIIAU.py create mode 100644 lib_siiau/__init__.py create mode 100644 lib_siiau/libSIIAU.py create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 894a44c..7f94d2b 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,7 @@ venv.bak/ # mypy .mypy_cache/ + +# Poetry Stuff +poetry.lock +*.egg-info/ diff --git a/README.md b/README.md index d0e351e..961b68f 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,19 @@ ### Extrae información de alumnos y profesores de la Universidad de Guadalajara -**** -* ##### __Dependencias__ +* #### __Dependencias__ * python 2 * requests -* ##### __Método de uso__ +* #### __Método de uso__ ``` -#extraer nombre +# extraer nombre from libSIIAU import Alumno codigo = "123456789" alumno = Alumno(codigo, "uno2ytres") print "Nombre: %s" % alumno.nombre -#Validar codigo y NIP +# Validar codigo y NIP from libSIIAU import Alumno codigo = "123456789" alumno = Alumno(codigo, "nip_incorrecto") @@ -24,4 +23,3 @@ if alumno.valido: else: print "Codigo o nip incorrectos" ``` - diff --git a/libSIIAU.py b/libSIIAU.py deleted file mode 100644 index f36d495..0000000 --- a/libSIIAU.py +++ /dev/null @@ -1,477 +0,0 @@ -#!/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='