-
Notifications
You must be signed in to change notification settings - Fork 0
/
webservices.py
executable file
·44 lines (35 loc) · 1.57 KB
/
webservices.py
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
# -*- coding: utf-8 -*-
from suds.client import Client
from suds.sax.element import Element
import metodos
def infoGeneral():
#Definimos URLs de Acceso a los Webservices
urlGeneral = 'http://academico.espoch.edu.ec/OAS_Interop/Infogeneral.wsdl'
clienteGeneral = Client(urlGeneral)
#Definimos el nombre de usuario
user = Element('acad:username').setText('webmail')
#Definimos la contraseña
pwd = Element('acad:password').setText('webmail')
#Creamos el elemento padre, y el espacio de nombres
reqsoapheader = Element('acad:credentials', ns=['acad','http://academico.espoch.edu.ec/'])
#agregamos usuario y contraseña al padre
reqsoapheader.children = [user, pwd]
clienteGeneral.set_options(soapheaders=reqsoapheader)
return clienteGeneral
#Definimos URLs de Acceso a los Webservices
def infoCarrera():
#Definimos URLs de Acceso a los Webservices
urlCarrera = 'http://academico.espoch.edu.ec/OAS_Interop/Infocarrera.wsdl'
#Creamos el clientes
clienteCarrera = Client(urlCarrera)
#Definimos el nombre de usuario
user = Element('acad:username').setText('webmail')
#Definimos la contraseña
pwd = Element('acad:password').setText('webmail')
#Creamos el elemento padre, y el espacio de nombres
reqsoapheader = Element('acad:credentials', ns=['acad','http://academico.espoch.edu.ec/'])
#agregamos usuario y contraseña al padre
reqsoapheader.children = [user, pwd]
#Seteamos los soapheaders con las credenciales de login
clienteCarrera.set_options(soapheaders=reqsoapheader)
return clienteCarrera