Skip to content

Instantly share code, notes, and snippets.

@lcruz
Created November 4, 2014 00:06
Show Gist options
  • Save lcruz/39f89115c826a0401ba0 to your computer and use it in GitHub Desktop.
Save lcruz/39f89115c826a0401ba0 to your computer and use it in GitHub Desktop.
Llamar a un servicio web
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