Exemplo n.º 1
0
def getGrados(request):
    if request.method == "GET":
        codigo = request.GET.get('cod')
        curso = request.GET.get('curso')
        server = SOAPProxy('www.abj-ws-devborja.c9users.io:8080')
        res = server.obtenerGruposAsignaturaInformatica(codigo, curso)
        return HttpResponse(res)
Exemplo n.º 2
0
def obtenerGrupos(request):
    if request.method == "POST":
        server = SOAPProxy('www.abj-ws-devborja.c9users.io:8080')
        server2 = SOAPProxy('www.abj-ws-devborja.c9users.io:8082')
        body_unicode = request.body.decode('utf-8')
        received_json_data = json.loads(body_unicode)
        data = []
        for key, value in received_json_data.iteritems():
            for item in value:
                obj = {}
                res = server.obtenerGruposAsignaturaInformatica(item, key)
                res = json.loads(server.obtenerHorarioAsignatura(item, res["grupos"][0]))
                #res = json.loads(server.obtenerHorarioAsignatura(item, "01"))
                obj["nombreAsignatura"] = res["nombreAsignatura"]
                obj["eventos"] = res["horarioGrupoAsignatura"][0]["eventos"]
                data.append(obj)
        with open('anual.json') as data_file:
            dataCal = json.load(data_file)
        horario = server2.crearCalendarioCompleto(json.dumps(data), json.dumps(dataCal))
        calendario = {}
        calendario["calendario"] = horario
        return HttpResponse(json.dumps(calendario))