示例#1
0
def setup_connection():
    result = urllib2.install_opener(urllib2.build_opener(HTTPSHandlerV3()))
    logging.raiseExceptions = 0

    beamlineScheduleServiceURL = base + \
         'beamlineScheduleService/beamlineScheduleWebService.wsdl'

    runScheduleServiceURL = base + \
         'runScheduleService/runScheduleWebService.wsdl'

    try:
        credentials = dict(username=username, password=password)
        t = HttpAuthenticated(**credentials)
        if debug:
            print t.u2handlers()
            print t.credentials()
        runScheduleServiceClient = Client(runScheduleServiceURL)
        runScheduleServiceClient.options.cache.setduration(seconds=10)
        result = setSoapHeader(runScheduleServiceClient, username, password)
        beamlineScheduleServiceClient = Client(beamlineScheduleServiceURL)
        beamlineScheduleServiceClient.options.cache.setduration(seconds=10)
        result = setSoapHeader(beamlineScheduleServiceClient, username, password)
    except Exception, ex:
        print "CANNOT OPEN SERVICES:" + str(ex)
        raise
        exit(-1)
    def u2handlers(self):
        handlers = HttpAuthenticated.u2handlers(self)

        context = ssl._create_unverified_context()

        # add an HTTPS handler, using the custom context
        handlers.append(HTTPSHandler(context=context))

        return handlers
示例#3
0
    def u2handlers(self):
        # use handlers from superclass
        handlers = HttpAuthenticated.u2handlers(self)
        # create custom ssl context, e.g.
        ctx = ssl.create_default_context(cafile=CERTIFICATE_LOCATION)
        # configure context as needed...
        ctx.check_hostname = False

        # add a https handler using the custom context
        handlers.append(HTTPSHandler(context=ctx))
        return handlers
示例#4
0
def setup_connection():

    home = expanduser("~")
    credentials = os.path.join(home, 'scheduling.ini')

    cf = ConfigParser.ConfigParser()
    cf.read(credentials)
    username = cf.get('credentials', 'username')
    password = cf.get('credentials', 'password')
    beamline = cf.get('settings', 'beamline')

    # Uncomment one if using ANL INTERNAL or EXTERNAL network
    #base = cf.get('hosts', 'internal')
    base = cf.get('hosts', 'external')

    result = urllib2.install_opener(urllib2.build_opener(HTTPSHandlerV3()))
    logging.raiseExceptions = 0

    beamlineScheduleServiceURL = base + \
        'beamlineScheduleService/beamlineScheduleWebService.wsdl'

    runScheduleServiceURL = base + \
        'runScheduleService/runScheduleWebService.wsdl'

    try:
        credentials = dict(username=username, password=password)
        t = HttpAuthenticated(**credentials)
        if debug:
            print t.u2handlers()
            print t.credentials()
        runScheduleServiceClient = Client(runScheduleServiceURL)
        runScheduleServiceClient.options.cache.setduration(seconds=10)
        result = setSoapHeader(runScheduleServiceClient, username, password)
        beamlineScheduleServiceClient = Client(beamlineScheduleServiceURL)
        beamlineScheduleServiceClient.options.cache.setduration(seconds=10)
        result = setSoapHeader(beamlineScheduleServiceClient, username,
                               password)
    except Exception, ex:
        print "CANNOT OPEN SERVICES:" + str(ex)
        raise
        exit(-1)
示例#5
0
def setup_connection():

    home = expanduser("~")
    credentials = os.path.join(home, 'scheduling.ini')

    cf = ConfigParser.ConfigParser()
    cf.read(credentials)
    username = cf.get('credentials', 'username')
    password = cf.get('credentials', 'password')
    beamline = cf.get('settings', 'beamline')

    # Uncomment one if using ANL INTERNAL or EXTERNAL network
    #base = cf.get('hosts', 'internal')
    base = cf.get('hosts', 'external')

    result = urllib2.install_opener(urllib2.build_opener(HTTPSHandlerV3()))
    logging.raiseExceptions = 0

    beamlineScheduleServiceURL = base + \
        'beamlineScheduleService/beamlineScheduleWebService.wsdl'

    runScheduleServiceURL = base + \
        'runScheduleService/runScheduleWebService.wsdl'

    try:
        credentials = dict(username=username, password=password)
        t = HttpAuthenticated(**credentials)
        if debug:
            print t.u2handlers()
            print t.credentials()
        runScheduleServiceClient = Client(runScheduleServiceURL)
        runScheduleServiceClient.options.cache.setduration(seconds=10)
        result = setSoapHeader(runScheduleServiceClient, username, password)
        beamlineScheduleServiceClient = Client(beamlineScheduleServiceURL)
        beamlineScheduleServiceClient.options.cache.setduration(seconds=10)
        result = setSoapHeader(
            beamlineScheduleServiceClient, username, password)
    except Exception, ex:
        print "CANNOT OPEN SERVICES:" + str(ex)
        raise
        exit(-1)
示例#6
0
    def u2handlers(self):

        # use handlers from superclass
        handlers = HttpAuthenticated.u2handlers(self)

        # create custom ssl context, e.g.:
        ctx = ssl._create_unverified_context()
        # configure context as needed...
        ctx.check_hostname = False

        # add a https handler using the custom context
        handlers.append(HTTPSHandler(context=ctx))
        return handlers
示例#7
0
    def u2handlers(self):
        """
        Defines an http handler appropriate for the b59 server.

        Returns
        -------

        handlers : urllib2 https handler
        HTTPS communications handler with context configured for
        communication with ALC server.

        """

        # Use handlers from superclass
        handlers = HttpAuthenticated.u2handlers(self)

        # Create ssl context with correct tls version and cipher set
        ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        ctx.set_ciphers('HIGH:!DH:!aNULL')
        # Add a https handler using the ssl context
        handlers.append(HTTPSHandler(context=ctx))

        return handlers
示例#8
0
 def u2handlers(self):
     handlers = HttpsAuth.u2handlers(self)
     ssl_context = ssl._create_unverified_context()
     handlers.append(HTTPSHandler(context=ssl_context))
     return handlers
示例#9
0
 def u2handlers(self):
     handlers = HttpAuthenticated.u2handlers(self)
     handlers.append(HTTPSHandlerNoVerify())
     return handlers
示例#10
0
 def u2handlers(self):
     handlers = HttpAuthenticated.u2handlers(self)
     handlers.append(HTTPSHandlerNoVerify())
     return handlers
示例#11
0
 def u2handlers(self):
     handlers = [
         urllib2.HTTPSHandler(context=ssl._create_unverified_context())
     ]
     handlers.extend(HttpAuthenticated.u2handlers(self))
     return handlers
 def u2handlers(self):
   handlers = [ urllib2.HTTPSHandler(context=ssl._create_unverified_context()) ]
   handlers.extend(HttpAuthenticated.u2handlers(self))
   return handlers
示例#13
0
 def u2handlers(self):
     handlers = HttpAuthenticated.u2handlers(self)
     context = ssl._create_unverified_context()
     handlers.append(HTTPSHandler(context=context))
     return handlers