예제 #1
0
 def crear_cliente_academica():
     """
     Metodo generico para crear una conexion con el webservice SGA - académico
     ejem datos de carreras,matriculas,ofertas...
     :return: cliente de conexion tipo suds.client.Client
     """
     from app.configuracion.models import DetalleParametrizacion
     url = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS',
         codigo='sgaws_url_academica').first()
     location = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS',
         codigo='sgaws_location_academica').first()
     port = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS',
         codigo='sgaws_port_academica').first()
     user = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS', codigo='sgaws_usuario').first()
     passwd = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS', codigo='sgaws_password').first()
     client = Client(url=url.valor,
                     username=user.valor,
                     password=passwd.valor,
                     location=location.valor)
     client.set_options(port=port.valor)
     return client
예제 #2
0
 def crear_cliente_personal():
     """
     Metodo generico para crear una conexion con el webservice SGA - personal
     Ejem datos de estudiantes,docente,usuario
     :return: cliente de conexion tipo suds.client.Client
     """
     from app.configuracion.models import DetalleParametrizacion
     url = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS',
         codigo='sgaws_url_personal').first()
     location = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS',
         codigo='sgaws_location_personal').first()
     port = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS',
         codigo='sgaws_port_personal').first()
     user = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS', codigo='sgaws_usuario').first()
     passwd = DetalleParametrizacion.objects.filter(
         parametrizacion__codigo='SGA_WS', codigo='sgaws_password').first()
     client = Client(url=url.valor,
                     username=user.valor,
                     password=passwd.valor,
                     location=location.valor)
     client.set_options(port=port.valor)
     return client
예제 #3
0
def get_board(crs, token):
    """
        Get a live departure board from the LDBWS service.
        The data shows the next 20 trains currently scheduled
        to leave from that station. The data should match
        that shown on the real-life departure boards in the station
        and in mapping apps, etc.

         - crs: a three-letter token identifying a UK station.
                You can find out the CRS of a station at
                http://www.nationalrail.co.uk/stations_destinations/48541.aspx
         - token: An API access token.
    """
    client = Client(wsdl_url, location=service_url)

    access_token = client.factory.create("ns2:AccessToken")
    access_token.TokenValue = token
    client.set_options(soapheaders=access_token)

    service = client.service
    result = service.GetDepartureBoard(20, crs)
    return result