Created
November 4, 2014 00:06
-
-
Save lcruz/39f89115c826a0401ba0 to your computer and use it in GitHub Desktop.
Llamar a un servicio web
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from suds.client import Client | |
def encode_utf8(value): | |
if not value is None: | |
return value.encode("utf-8") | |
def get_schedules(): | |
# Definir la llamada al WSDL | |
WSDL_URL = "<path to wsdl>" | |
client = Client(WSDL_URL) | |
client.set_options(cache=None) | |
# Ejecutar la llamada | |
schedule = client.service.Execute() | |
# Formatear los datos | |
schedule = [ | |
{ | |
"classroom" : x["SalaDescripcion"], | |
"start" : x["BloqueInicio"], | |
"end" : x["BloqueFin"], | |
"subject" : encode_utf8(x["ProgramacionPeriodoMateria"]), | |
"nrc" : x["ProgramacionPeriodoNRC"], | |
"teacher" : encode_utf8(x["ProgramacionPeriodoDocente"]), | |
"faculty" : encode_utf8(x["ProgramacionPeriodoFacultad"]) | |
} | |
for x in schedule['WSHorariosalas.WSHorariosalasItem'] | |
] | |
return schedule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment