コード例 #1
0
ファイル: www.py プロジェクト: chintal/tendril
    def _get_fresh_content(self, request):
        """
        Retrieve a fresh copy of the resource from the source.

        :param request: the request object for which the response
                        is needed.
        :return: the response to the request

        """
        response = HttpAuthenticated.send(self, request)
        return response
コード例 #2
0
    def _wsdl_client(self, service_name):

        # Handling of redirection at soleil needs cookie handling
        cj = CookieJar()
        url_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

        trans = HttpAuthenticated(username = self.ws_username, password = self.ws_password)
        print '_wsdl_client %s' % service_name, trans
        trans.urlopener = url_opener
        urlbase = service_name + "?wsdl"
        locbase = service_name
       
        ws_root = self.ws_root.strip()

        url = ws_root + urlbase
        loc = ws_root + locbase

        ws_client = Client(url, transport=trans, timeout=3, \
                           location=loc, cache = None)

        return ws_client
コード例 #3
0
    def _wsdl_client(self, service_name):

        # Handling of redirection at soleil needs cookie handling
        cj = CookieJar()
        url_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

        trans = HttpAuthenticated(username=self.ws_username, password=self.ws_password)
        logging.info("_wsdl_client service_name %s - trans %s" % (service_name, trans))
        print("_wsdl_client service_name %s - trans %s" % (service_name, trans))

        trans.urlopener = url_opener
        urlbase = service_name + "?wsdl"
        locbase = service_name

        ws_root = self.ws_root.strip()

        url = ws_root + urlbase
        loc = ws_root + locbase

        print("_wsdl_client, url", url)
        ws_client = Client(url, transport=trans, timeout=3, location=loc, cache=None)

        return ws_client
コード例 #4
0
 def send(self, request):
     """
     Send a request and return the response. If the minimum number of
     seconds between requests have not yet elapsed, then the function
     sleeps for the remaining period and then passes the request along.
     """
     now = int(time.time())
     logger.debug('Getting SOAP response')
     tsincelast = now - self._last_called
     if tsincelast < self._minumum_spacing:
         tleft = self._minumum_spacing - tsincelast
         logger.info("Throttling SOAP client for {0}".format(tleft))
         time.sleep(tleft)
     self._last_called = now
     return HttpAuthenticated.send(self, request)
コード例 #5
0
ファイル: www.py プロジェクト: chintal/tendril
 def send(self, request):
     """
     Send a request and return the response. If the minimum number of
     seconds between requests have not yet elapsed, then the function
     sleeps for the remaining period and then passes the request along.
     """
     now = int(time.time())
     logger.debug('Getting SOAP response')
     tsincelast = now - self._last_called
     if tsincelast < self._minumum_spacing:
         tleft = self._minumum_spacing - tsincelast
         logger.info("Throttling SOAP client for {0}".format(tleft))
         time.sleep(tleft)
     self._last_called = now
     return HttpAuthenticated.send(self, request)
コード例 #6
0
ファイル: ipcontrol-export.py プロジェクト: Neiby/IPControl
def main():

    # Build transport and client objects using HttpAuth for authentication
    # and MessagePlugin to allow the capturing of raw XML, necessary for
    # extracting the IPControl session ID later

    plugin = MyPlugin()
    credentials = dict(username=user, password=pw)
    transport = HttpAuthenticated(**credentials)
    client = Client('http://ipcontrol.foobar.net/inc-ws/services/Exports?wsdl',
                    headers={
                        'username': user,
                        'password': pw
                    },
                    transport=transport,
                    plugins=[plugin])

    query_parameters = ('ipaddress = 1.2.3.4', False
                        )  # The boolean is for includeFreeBlocks

    # Exports must be initialized first. The IPControl session ID can then
    # be extracted from the raw reply data. This is necessary later when
    # the export service is called.

    context = client.service.initExportChildBlock(*query_parameters)
    session_id_re = re.search(r'([0-9-]{19,20})',
                              str(plugin.last_received_raw), re.M)
    if session_id_re:
        session_id = session_id_re.group(1)
        print("SESSION ID: {}".format(session_id))
    else:
        print("NO SESSION ID FOUND")
        sys.exit()

    # Build a new SOAP header where the 'sessionID' is set to the value extracted
    # from the raw initialization reply data above, then apply the new
    # header to the existing client object.

    sid = Element(
        'sessionID',
        ns=('ns1', 'http://xml.apache.org/axis/session')).setText(session_id)
    sid.set("SOAP-ENV:mustUnderstand", "0")
    sid.set("SOAP-ENV:actor", "http://schemas.xmlsoap.org/soap/actor/next")
    sid.set("xsi:type", "soapenc:long")
    client.set_options(soapheaders=sid)

    result = client.service.exportChildBlock(context)
    print("RESULT: {}".format(result))
コード例 #7
0
ファイル: SmisLink.py プロジェクト: drnasmith/py-ispyb
    def init_app(self, app):
        """Initializes user office class.

        Args:
            app (flask app): Flask app
        """
        http_auth = HttpAuthenticated(
            username=app.config.get("SMIS_USERNAME"),
            password=app.config.get("SMIS_PASSWORD")
            )
        self.smis_ws = Client(
            app.config.get("SMIS_WS_URL"),
            transport=http_auth,
            cache=None,
            timeout=180
            )
コード例 #8
0
    def preProcess(self, _edObject=None):
        EDPluginControl.preProcess(self)

        # Initializing webservices
        self.DEBUG("EDPluginBioSaxsISPyBv1_0.preProcess")
        self.dataBioSaxsSample = self.dataInput.sample
        user = None
        password = ""
        if self.dataBioSaxsSample:
            if self.dataBioSaxsSample.login:
                user = self.dataBioSaxsSample.login.value
                password = self.dataBioSaxsSample.passwd.value
        if not user:
            self.ERROR(
                "No login/password information in sample configuration. Giving up."
            )
            self.setFailure()
            return

        # I don't trust in this authentication.... but it is going to work soon
        self.httpAuthenticatedToolsForBiosaxsWebService = HttpAuthenticated(
            username=user, password=password)
        self.client = Client(
            self.URL,
            transport=self.httpAuthenticatedToolsForBiosaxsWebService,
            cache=None)

        if self.dataInput.dammifAvg:
            self.dammifAvg = self.dataInput.dammifAvg.value

        if self.dataInput.dammifFilter:
            self.dammifFilter = self.dataInput.dammifFilter.value

        if self.dataInput.dammifStart:
            self.dammifStart = self.dataInput.dammifStart.value

        if self.dataInput.dammifJobs:
            self.dammifJobs = self.dataInput.dammifJobs.value

        if self.dataInput.scatterPlotFile:
            self.scatterPlotFilePath = self.dataInput.scatterPlotFile.path.value

        if self.dataInput.guinierPlotFile:
            self.guinierPlotFilePath = self.dataInput.guinierPlotFile.path.value

        if self.dataInput.kratkyPlotFile:
            self.kratkyPlotFilePath = self.dataInput.kratkyPlotFile.path.value
コード例 #9
0
    def preProcess(self, _edObject=None):
        EDPluginControl.preProcess(self)
        # Initializing webservices
        self.DEBUG("EDPluginBioSaxsISPyB_HPLCv1_0.preProcess")
        self.dataBioSaxsSample = self.dataInput.sample
        user = None
        password = ""
        if self.dataBioSaxsSample:
            if self.dataBioSaxsSample.login:
                user = self.dataBioSaxsSample.login.value
                password = self.dataBioSaxsSample.passwd.value
                if self.dataBioSaxsSample.ispybURL:
                    self.URL = self.dataBioSaxsSample.ispybURL.value
        if not user:
            self.ERROR(
                "No login/password information in sample configuration. Giving up. falling back on test mode"
            )
            #             self.setFailure()
            #             return
            user = "******"
            password = "******"

        # construct code based on letters + numbers user concept
        self.code = ''.join(i for i in user if i.isalpha())
        self.number = ''.join(i for i in user if i.isdigit())

        # I don't trust in this authentication.... but it is going to work soon

        self.httpAuthenticatedToolsForBiosaxsWebService = HttpAuthenticated(
            username=user, password=password)
        self.client = Client(
            self.URL,
            transport=self.httpAuthenticatedToolsForBiosaxsWebService,
            cache=None)

        if (self.dataInput.hdf5File is not None):
            if (self.dataInput.hdf5File.path is not None):
                self.hdf5File = self.dataInput.hdf5File.path.value

        if (self.dataInput.jsonFile is not None):
            if (self.dataInput.jsonFile.path is not None):
                self.jsonFile = self.dataInput.jsonFile.path.value

        if (self.dataInput.hplcPlot is not None):
            if (self.dataInput.hplcPlot.path is not None):
                self.hplcPlot = self.dataInput.hplcPlot.path.value
コード例 #10
0
    def _get_suds_client(self, url):
        """
        Make a suds client for a specific WSDL (via url).
        For now, we have to work around a few minor issues with the Suds cache
        and different authentication methods based on uri or file:// access.
        """

        if self.fromurl == False:
            # We're file:// access, so don't use https transport.
            t = HttpAuthenticated(username = self.username, password = self.password)

            # Suds will intermittantly throw a SAX exception trying to parse cached files.
            # if it does this, retry.
            c = Client(url, transport=t, doctor=DOCTOR)
        else:
            c = Client(url, username=self.username, password=self.password,doctor=DOCTOR)
        return c
コード例 #11
0
 def process(self, _edObject=None):
     """
     Uses ToolsForCollectionWebService for storing the workflow status
     """
     EDPluginISPyBv1_4.process(self)
     self.DEBUG("EDPluginISPyBStoreWorkflowStepv1_4.process")
     # First get the image ID
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(
         self.strToolsForCollectionWebServiceWsdl,
         transport=httpAuthenticatedToolsForCollectionWebService,
         cache=None)
     dictWorkflowStep = {
         "workflowId":
         self.getXSValue(self.dataInput.workflowId),
         "workflowStepType":
         self.getXSValue(self.dataInput.workflowStepType),
         "status":
         self.getXSValue(self.dataInput.status),
         "folderPath":
         self.getXSValue(self.dataInput.folderPath),
         "imageResultFilePath":
         self.getXSValue(self.dataInput.imageResultFilePath),
         "htmlResultFilePath":
         self.getXSValue(self.dataInput.htmlResultFilePath),
         "resultFilePath":
         self.getXSValue(self.dataInput.resultFilePath),
         "comments":
         self.getXSValue(self.dataInput.comments),
         "crystalSizeX":
         self.getXSValue(self.dataInput.crystalSizeX),
         "crystalSizeY":
         self.getXSValue(self.dataInput.crystalSizeY),
         "crystalSizeZ":
         self.getXSValue(self.dataInput.crystalSizeZ),
         "maxDozorScore":
         self.getXSValue(self.dataInput.maxDozorScore),
     }
     strDictWorkflowStep = json.dumps(dictWorkflowStep)
     self.iWorkflowStepId = clientToolsForCollectionWebService.service.storeWorkflowStep(
         strDictWorkflowStep)
     self.DEBUG(
         "EDPluginISPyBStoreWorkflowStepv1_4.process: WorkflowStepId = {0}".
         format(self.iWorkflowStepId))
コード例 #12
0
ファイル: proposals.py プロジェクト: meguiraun/ISARAloader
def get_proposals(username, password):
    proposals = list()
    # Connection and user parameters
    url_ispyb = "https://ispyb.maxiv.lu.se/ispyb/ispyb-ws/ispybWS/CrimsWebService?wsdl"

    # Authentication
    HTTPSoapService = HttpAuthenticated(username=username,
                                        password=password,
                                        proxy=proxies)
    client = Client(url_ispyb,
                    transport=HTTPSoapService,
                    cache=None,
                    timeout=15)

    # Store shipping
    proteins = client.service.findProteinAcronyms()
    proposals = list(json.loads(proteins).keys())
    return proposals
コード例 #13
0
ファイル: __init__.py プロジェクト: kakwa/gforge-soap-client
 def __init__(self, url, login, password, project):
     """ Init a gforge client
     :param url: url to the soap entry point
     :param login: api login
     :param password: api password
     :param project: project to query
     :rtype: SoapClient object
     """
     self.login = login
     self.password = password
     self.url = url
     self.project = project
     t = HttpAuthenticated(username=login, password=password)
     self.client = Client(url, transport=t)
     self.GFapi = self.client.service
     self.trackers = {}
     self.trackers_name = []
     self.trackers_raw = {}
コード例 #14
0
    def process(self, _edObject=None):
        """
        Uses ToolsForCollectionWebService for storing the workflow status
        """
        EDPluginISPyBv1_4.process(self)
        self.DEBUG("EDPluginISPyBUpdateDataCollectionGroupWorkflowIdv1_4.process")
        xsDataInput = self.getDataInput()
#        print xsDataInput.marshal()
        httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(username=self.strUserName, password=self.strPassWord)
        clientToolsForCollectionWebService = Client(self.strToolsForCollectionWebServiceWsdl,
                                                    transport=httpAuthenticatedToolsForCollectionWebService,
                                                    cache=None)
        self.iDataCollectionGroupId = clientToolsForCollectionWebService.service.updateDataCollectionGroupWorkflowId(\
                fileLocation=self.getXSValue(xsDataInput.fileLocation), \
                fileName=self.getXSValue(xsDataInput.fileName), \
                workflowId=self.getXSValue(xsDataInput.workflowId), \
                )
        self.DEBUG("EDPluginISPyBUpdateDataCollectionGroupWorkflowIdv1_4.process: DataCollectionGroupId=%r" % self.iDataCollectionGroupId)
コード例 #15
0
 def process(self, _edObject=None):
     """
     Retrieves the contents of the DataCollectionContainer in ISPyB
     """
     EDPluginISPyBv1_4.process(self)
     self.DEBUG("EDPluginISPyBRetrieveDataCollectionv1_4.process")
     infile = self.getDataInput()
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(
         self.strToolsForCollectionWebServiceWsdl,
         transport=httpAuthenticatedToolsForCollectionWebService,
         cache=None)
     self.collectParameters = None
     if infile.image is not None:
         inpath = infile.image.path.value
         indir = os.path.dirname(inpath)
         infilename = os.path.basename(inpath)
         collect_params = clientToolsForCollectionWebService.service.findDataCollectionFromFileLocationAndFileName(
             indir, infilename)
     elif infile.dataCollectionId is not None:
         dataCollectionId = infile.dataCollectionId.value
         collect_params = clientToolsForCollectionWebService.service.findDataCollection(
             dataCollectionId)
     else:
         self.ERROR("Neither image nor data collection id given as input!")
     if collect_params is None:
         self.ERROR("Couldn't find collect for image %s in ISPyB!" % inpath)
         self.setFailure()
     else:
         # the result is a suds.sudsobject.Object, we need to convert it
         res = XSDataISPyBDataCollection()
         try:
             for k, v in collect_params:
                 setattr(res, k, v)
         except:
             self.ERROR(
                 'something went wrong converting the result to a XSDataResultRetrieveDataCollection'
             )
             self.setFailure()
         else:
             self.collectParameters = XSDataResultRetrieveDataCollection()
             self.collectParameters.dataCollection = res
コード例 #16
0
 def process(self, _edObject=None):
     """
     Uses ToolsForCollectionWebService 
     """
     EDPluginExec.process(self)
     self.DEBUG("EDPluginISPyBStoreMotorPositionv1_4.process")
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(
         self.strToolsForCollectionWebServiceWsdl,
         transport=httpAuthenticatedToolsForCollectionWebService)
     # Loop over all positions
     motorPosition = self.createMotorPosition3VO(
         clientToolsForCollectionWebService, self.dataInput.motorPosition)
     self.motorPositionId = clientToolsForCollectionWebService.service.storeOrUpdateMotorPosition(
         motorPosition=motorPosition)
     self.DEBUG(
         "EDPluginISPyBStoreMotorPositionv1_4.process: motorPositionId=%r" %
         self.motorPositionId)
コード例 #17
0
ファイル: axlhandler.py プロジェクト: yvigara/pyaxl
    def __init__(self, configname='default'):

        wsdl = None
        importdoctor = None
        config = pyaxl.configuration.registry.get(configname)
        if config.schema_path is None:
            modpath = os.path.dirname(pyaxl.__file__)
            cachefiles = os.path.join(get_cache_path(configname), 'files')
            if not os.path.exists(cachefiles):
                print(
                    'Cache for configuration "%s" doesn\'t exist. Use pyaxl_import_wsdl_to create it first!'
                    % configname,
                    file=sys.stderr)
                raise Exception('Path for cache doesn\'t exist')
            with open(cachefiles) as f:
                wsdl = f.readline().strip()
                importdoctor = doctor.ImportDoctor(
                    *[doctor.Import(l.strip()) for l in f.readlines()])
        else:
            schema_path = config.schema_path
            wsdl = os.path.join(schema_path, AXLAPI)
            if not os.path.exists(wsdl):
                raise ValueError(
                    'The version %s is not supported. WSDL was not found.' %
                    config.version)
            wsdl = FILE_PREFIX % wsdl
            importdoctor = AXLImportDoctor(schema_path)
        httpconfig = dict(username=config.user,
                          password=config.passwd,
                          proxy=config.proxy)
        transport = HttpAuthenticated(**httpconfig)
        plugins = list()
        if config.transport_debugger:
            plugins.append(DebugTransportPlugin())

        kwargs = dict(cache=get_cache(configname),
                      location='%s/%s' % (config.host, config.path),
                      doctor=importdoctor,
                      plugins=plugins,
                      transport=transport)
        kwargs.update(config.suds_config)
        super(AXLClient, self).__init__(wsdl, **kwargs)
コード例 #18
0
 def process(self, _edObject=None):
     """
     Uses ToolsForCollectionWebService for storing the workflow status
     """
     EDPluginISPyBv1_4.process(self)
     self.DEBUG("EDPluginISPyBUpdateWorkflowStatusv1_4.process")
     # Get the workflow ID and status
     iWorkflowId = self.dataInput.workflowId.value
     strStatus = self.dataInput.newStatus.value
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(
         self.strToolsForCollectionWebServiceWsdl,
         transport=httpAuthenticatedToolsForCollectionWebService,
         cache=None)
     self.iWorkflowId = clientToolsForCollectionWebService.service.updateWorkflowStatus(
         iWorkflowId, strStatus)
     self.DEBUG(
         "EDPluginISPyBUpdateWorkflowStatusv1_4.process: WorkflowId=%d" %
         self.iWorkflowId)
コード例 #19
0
ファイル: web_service.py プロジェクト: CURE-EMR/oca10
 def init_connection(self, company):
     if company.postlogistics_test_mode:
         # We must change location for namespace as suds will take the wrong
         # one and find nothing
         # In order to have the test_mode working, it is necessary to patch
         # suds with https://fedorahosted.org/suds/attachment/ticket/239/suds_recursion.patch # noqa
         ns = "https://int.wsbc.post.ch/wsbc/barcode/v2_2/types"
         location = "https://int.wsbc.post.ch/wsbc/barcode/v2_2?xsd=1"
         imp = Import(ns, location)
         doctor = ImportDoctor(imp)
         t = IntegrationTransport(username=company.postlogistics_username,
                                  password=company.postlogistics_password)
         self.client = Client(company.postlogistics_wsdl_url,
                              transport=t,
                              cache=NoCache(),
                              doctor=doctor)
     else:
         t = HttpAuthenticated(username=company.postlogistics_username,
                               password=company.postlogistics_password)
         self.client = Client(company.postlogistics_wsdl_url, transport=t)
コード例 #20
0
    def process(self, _edObject=None):
        """
        Stores the contents of the DataCollectionContainer in ISPyB.
        """
        EDPluginExec.process(self)
        self.DEBUG("EDPluginISPyBStoreDataCollectionv1_4.process")
        xsDataInputStoreDataCollection = self.getDataInput()
        httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
            username=self.strUserName, password=self.strPassWord)
        clientToolsForCollectionWebService = Client(
            self.strToolsForCollectionWebServiceWsdl,
            transport=httpAuthenticatedToolsForCollectionWebService)

        # DataCollectionProgram
        self.iDataCollectionId = self.storeDataCollectionProgram(
            clientToolsForCollectionWebService, xsDataInputStoreDataCollection)
        if self.iDataCollectionId is None:
            self.ERROR("Couldn't create entry for DataCollectionId in ISPyB!")
            self.setFailure()
            self.bContinue = False
コード例 #21
0
ファイル: pycontrol.py プロジェクト: apackeer/pycontrol
    def _get_suds_client(self, url, **kw):
        """
        Make a suds client for a specifij WSDL (via url).
        Added new Suds cache features. Warning: These don't work on
        Windows. *nix should be fine. Also exposed general kwargs to pass
        down to Suds for advance users who don't want to deal with set_options().
        """

        if self.fromurl == False:
            # We're file:// access, so don't use https transport.
            t = HttpAuthenticated(username=self.username,
                                  password=self.password)
            c = Client(url, transport=t, doctor=DOCTOR, **kw)
        else:
            c = Client(url,
                       username=self.username,
                       password=self.password,
                       doctor=DOCTOR,
                       **kw)
        return c
コード例 #22
0
    def process(self, _edObject=None):
        """
        Upload the new content of data collection into ISPyB
        """
        EDPluginISPyBv1_4.process(self)
        self.DEBUG("EDPluginISPyBUpdateSnapshotsv1_4.process")

        httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
            username=self.strUserName, password=self.strPassWord)
        clientToolsForCollectionWebService = Client(
            self.strToolsForCollectionWebServiceWsdl,
            transport=httpAuthenticatedToolsForCollectionWebService,
            cache=None)
        self.collectParameters = None

        xsDataInput = self.getDataInput()

        strImagePath = xsDataInput.image.path.value
        fileLocation = os.path.dirname(strImagePath)
        fileName = os.path.basename(strImagePath)

        dataCollection = clientToolsForCollectionWebService.service.findDataCollectionFromFileLocationAndFileName(
            fileLocation=fileLocation, fileName=fileName)

        if dataCollection is not None:

            if xsDataInput.xtalSnapshotFullPath1 is not None:
                dataCollection.xtalSnapshotFullPath1 = xsDataInput.xtalSnapshotFullPath1.path.value
            if xsDataInput.xtalSnapshotFullPath2 is not None:
                dataCollection.xtalSnapshotFullPath2 = xsDataInput.xtalSnapshotFullPath2.path.value
            if xsDataInput.xtalSnapshotFullPath3 is not None:
                dataCollection.xtalSnapshotFullPath3 = xsDataInput.xtalSnapshotFullPath3.path.value
            if xsDataInput.xtalSnapshotFullPath4 is not None:
                dataCollection.xtalSnapshotFullPath4 = xsDataInput.xtalSnapshotFullPath4.path.value

            self.dataCollectionId = clientToolsForCollectionWebService.service.storeOrUpdateDataCollection(
                dataCollection=dataCollection)

        self.DEBUG(
            "EDPluginISPyBUpdateSnapshotsv1_4.process: data collection id = %r"
            % self.dataCollectionId)
コード例 #23
0
    def process(self, _edObject=None):
        """
        Uses ToolsForCollectionWebService for storing the workflow status
        """
        EDPluginISPyBv1_4.process(self)
        self.DEBUG("EDPluginISPyBStoreWorkflowMeshv1_4.process")
        # First get the image ID
        xsDataInputWorkflowMesh = self.getDataInput()

        httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
            username=self.strUserName, password=self.strPassWord)
        clientToolsForCollectionWebService = Client(
            self.strToolsForCollectionWebServiceWsdl,
            transport=httpAuthenticatedToolsForCollectionWebService,
            cache=None)
        workflowMeshWS3VO = clientToolsForCollectionWebService.factory.create(
            'workflowMeshWS3VO')
        workflowMeshWS3VO.workflowId = self.getXSValue(
            xsDataInputWorkflowMesh.workflowId)
        workflowMeshWS3VO.bestPositionId = self.getXSValue(
            xsDataInputWorkflowMesh.bestPositionId)
        workflowMeshWS3VO.bestImageId = self.getXSValue(
            xsDataInputWorkflowMesh.bestImageId)
        workflowMeshWS3VO.value1 = self.getXSValue(
            xsDataInputWorkflowMesh.value1)
        workflowMeshWS3VO.value2 = self.getXSValue(
            xsDataInputWorkflowMesh.value2)
        workflowMeshWS3VO.value3 = self.getXSValue(
            xsDataInputWorkflowMesh.value3)
        workflowMeshWS3VO.value4 = self.getXSValue(
            xsDataInputWorkflowMesh.value4)
        workflowMeshWS3VO.cartographyPath = self.getXSValue(
            xsDataInputWorkflowMesh.cartographyPath)
        #        print workflowMeshWS3VO
        self.iWorkflowMeshId = clientToolsForCollectionWebService.service.storeOrUpdateWorkflowMesh(
            workflowMeshWS3VO)
        self.DEBUG(
            "EDPluginISPyBStoreWorkflowMeshv1_4.process: WorkflowId=%d" %
            self.iWorkflowMeshId)
コード例 #24
0
 def run(self, inData):
     dictConfig = UtilsConfig.getTaskConfig('ISPyB')
     username = dictConfig['username']
     password = dictConfig['password']
     httpAuthenticated = HttpAuthenticated(username=username,
                                           password=password)
     wdsl = dictConfig['ispyb_ws_url'] + '/ispybWS/ToolsForCollectionWebService?wsdl'
     client = Client(wdsl, transport=httpAuthenticated, cache=None)
     manufacturer = inData['manufacturer']
     model = inData['model']
     mode = inData['mode']
     detector = client.service.findDetectorByParam(
         "",
         manufacturer,
         model,
         mode
     )
     if detector is not None:
         outData = Client.dict(detector)
     else:
         outData = {}
     return outData
コード例 #25
0
 def process(self, _edObject=None):
     """
     Stores the contents of the AutoProcContainer in ISPyB.
     """
     EDPluginISPyBv1_4.process(self)
     self.DEBUG("EDPluginISPyBStoreAutoProcProgramAttachmentv1_4.process")
     xsDataInputStoreAutoProcProgramAttachment = self.getDataInput()
     httpAuthenticatedToolsForAutoprocessingWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForAutoprocessingWebService = Client(
         self.strToolsForAutoprocessingWebServiceWsdl,
         transport=httpAuthenticatedToolsForAutoprocessingWebService,
         cache=None)
     # AutoProcProgramAttachment
     listAutoProcProgramAttachment = xsDataInputStoreAutoProcProgramAttachment.getAutoProcProgramAttachment(
     )
     for xsDataAutoProcProgramAttachment in listAutoProcProgramAttachment:
         iAutoProcProgramAttachmentId = self.storeOrUpdateAutoProcProgramAttachment(
             clientToolsForAutoprocessingWebService,
             xsDataAutoProcProgramAttachment)
         self.dataOutput.addAutoProcProgramAttachmentId(
             XSDataInteger(iAutoProcProgramAttachmentId))
コード例 #26
0
 def process(self, _edObject=None):
     """
     Uses ToolsForCollectionWebService 
     """
     EDPluginISPyBv1_4.process(self)
     self.DEBUG("EDPluginISPyBGetPdbFilePathv1_4.process")
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(
         self.strToolsForCollectionWebServiceWsdl,
         transport=httpAuthenticatedToolsForCollectionWebService,
         cache=None)
     # Loop over all positions
     xsDataInputISPyBGetPdbFilePath = self.getDataInput()
     iDataCollectionId = self.getXSValue(
         xsDataInputISPyBGetPdbFilePath.dataCollectionId)
     self.strPathToPdbFile = clientToolsForCollectionWebService.service.getPdbFilePath(
                                 iDataCollectionId, \
                                 )
     self.DEBUG(
         "EDPluginISPyBGetPdbFilePathv1_4.process: path to pdb file=%r" %
         self.strPathToPdbFile)
コード例 #27
0
ファイル: __init__.py プロジェクト: rtucker-mozilla/hera
    def __init__(self, username, password, location, wsdl="System.Cache.wsdl"):

        # Sorry windows
        cur = os.path.dirname(__file__)
        url = "file://%s" % os.path.abspath(os.path.join(cur, 'wsdl', wsdl))

        # Apparently Zeus's wsdl is broken and we have to jimmy this thing in
        # manually.  See https://fedorahosted.org/suds/ticket/220 for details.
        # Also, you'll be happy to know that the zillion .wsdl files that Zeus
        # includes apparently have different targetNamespace's.  This one
        # happens to be 1.1, but if you load something else you'll probably
        # need to adjust it.
        imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
        imp.filter.add('http://soap.zeus.com/zxtm/1.1/')
        doctor = ImportDoctor(imp)

        transporter = HttpAuthenticated(username=username, password=password)

        self.client = Client(url,
                             doctor=doctor,
                             location=location,
                             transport=transporter)
コード例 #28
0
 def __init__(self, url, **kwargs):
     """
     @param url: The URL for the WSDL.
     @type url: str
     @param kwargs: keyword arguments.
     @see: L{Options}
     """
     options = Options()
     options.transport = HttpAuthenticated()
     self.options = options
     options.cache = ObjectCache(days=1)
     self.set_options(**kwargs)
     reader = DefinitionsReader(options, Definitions)
     self.wsdl = reader.open(url)
     plugins = PluginContainer(options.plugins)
     plugins.init.initialized(wsdl=self.wsdl)
     self.factory = Factory(self.wsdl)
     self.service = ServiceSelector(self, self.wsdl.services)
     self.sd = []
     for s in self.wsdl.services:
         sd = ServiceDefinition(self.wsdl, s)
         self.sd.append(sd)
     self.messages = dict(tx=None, rx=None)
コード例 #29
0
ファイル: driver.py プロジェクト: brocade-vadx/lbaas_plugin
    def createSlbServiceClient(self):
        def soapHeader():
            requestHeader = suds_element.Element('RequestHeader',
                                                 ns=AdxService.ns0)
            context = suds_element.Element('context').setText('default')
            requestHeader.append(context)
            return requestHeader

        url = self.wsdl_base + self.slb_service_wsdl
        location = "http://" + self.adxIpAddress + "/WS/SLB"
        transport = HttpAuthenticated(username=self.userName,
                                      password=self.password)
        self.transport = transport

        client = suds_client.Client(url,
                                    transport=transport,
                                    service='AdcSlb',
                                    location=location,
                                    timeout=300,
                                    plugins=[RemoveEmptyTags()])
        requestHeader = soapHeader()
        client.set_options(soapheaders=requestHeader)
        return client
コード例 #30
0
 def _soap_connectToPloneMeeting(self):
     """
       Connect to distant PloneMeeting.
       Either return None or the connected client.
     """
     settings = self.settings()
     url = self.request.form.get('form.widgets.pm_url') or settings.pm_url or ''
     username = self.request.form.get('form.widgets.pm_username') or settings.pm_username or ''
     password = self.request.form.get('form.widgets.pm_password') or settings.pm_password or ''
     timeout = self.request.form.get('form.widgets.pm_timeout') or settings.pm_timeout or ''
     imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
     d = ImportDoctor(imp)
     t = HttpAuthenticated(username=username, password=password)
     try:
         client = Client(url, doctor=d, transport=t, timeout=int(timeout))
         # call a SOAP server test method to check that everything is fine with given parameters
         client.service.testConnection('')
     except Exception, e:
         # if we are really on the configuration panel, display relevant message
         if self.request.get('URL', '').endswith('@@ws4pmclient-settings'):
             IStatusMessage(self.request).addStatusMessage(
                 _(CONFIG_UNABLE_TO_CONNECT_ERROR, mapping={'error': (e.message or str(e.reason))}), "error")
         return None
コード例 #31
0
    def process(self, _edObject=None):
        """
        Retrieves the contents of the DataCollectionContainer in ISPyB
        """
        EDPluginExec.process(self)
        self.DEBUG("EDPluginISPyBRetrieveDataCollectionv1_3.process")
        infile = self.getDataInput()
        inpath = infile.getImage().getPath().getValue()
        indir = os.path.dirname(inpath)
        infilename = os.path.basename(inpath)
        httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
            username=self.strUserName, password=self.strPassWord)
        clientToolsForCollectionWebService = Client(
            self.strToolsForCollectionWebServiceWsdl,
            transport=httpAuthenticatedToolsForCollectionWebService)
        self.collectParameters = None

        # DataCollectionProgram
        collect_params = clientToolsForCollectionWebService.service.findDataCollectionFromFileLocationAndFileName(
            in0=indir, in1=infilename)
        if collect_params is None:
            self.ERROR("Couldn't find collect for file %s in ISPyB!" % inpath)
            self.setFailure()
        else:
            # the result is a suds.sudsobject.Object, we need to convert it
            res = XSDataISPyBDataCollection()
            try:
                for k, v in collect_params:
                    setattr(res, k, v)
            except:
                self.ERROR(
                    'something went wrong converting the result to a XSDataResultRetrieveDataCollection'
                )
                self.setFailure()
            else:
                self.collectParameters = XSDataResultRetrieveDataCollection()
                self.collectParameters.dataCollection = res
コード例 #32
0
 def process(self, _edObject=None):
     """
     Uses ToolsForCollectionWebService for storing the workflow status
     """
     EDPluginISPyBv1_4.process(self)
     self.DEBUG("EDPluginISPyBSetDataCollectionsPositionsv1_4.process")
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(
         username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(
         self.strToolsForCollectionWebServiceWsdl,
         transport=httpAuthenticatedToolsForCollectionWebService,
         cache=None)
     # Loop over all positions
     listDataCollectionPosition = []
     for xsDataDataCollectionPosition in self.dataInput.dataCollectionPosition:
         dataCollectionPosition = clientToolsForCollectionWebService.factory.create(
             'dataCollectionPosition')
         # Get the workflow ID and status
         dataCollectionPosition.fileName = os.path.basename(
             xsDataDataCollectionPosition.fileName.path.value)
         dataCollectionPosition.fileLocation = os.path.dirname(
             xsDataDataCollectionPosition.fileName.path.value)
         dataCollectionPosition.startPosition = self.createMotorPosition3VO(
             clientToolsForCollectionWebService,
             xsDataDataCollectionPosition.startPosition)
         if xsDataDataCollectionPosition.endPosition is not None:
             dataCollectionPosition.endPosition = self.createMotorPosition3VO(
                 clientToolsForCollectionWebService,
                 xsDataDataCollectionPosition.endPosition)
         else:
             endMotorPosition3VO = None
         listDataCollectionPosition.append(dataCollectionPosition)
     self.listDataCollectionId = clientToolsForCollectionWebService.service.setDataCollectionsPositions(
         listDataCollectionPosition=listDataCollectionPosition)
     self.DEBUG(
         "EDPluginISPyBSetDataCollectionsPositionsv1_4.process: DataCollectionId=%r"
         % self.listDataCollectionId)
コード例 #33
0
    def preProcess(self, _edObject=None):
        EDPluginControl.preProcess(self)

        # Initializing webservices
        self.DEBUG("EDPluginBioSaxsISPyBModellingv1_0.preProcess")
        self.dataBioSaxsSample = self.dataInput.sample


        user = None
        password = ""
        if self.dataBioSaxsSample:
            if self.dataBioSaxsSample.login:
                user = self.dataBioSaxsSample.login.value
                password = self.dataBioSaxsSample.passwd.value
                self.URL = self.dataBioSaxsSample.ispybURL
        if not user:
            self.ERROR("No login/password information in sample configuration. Giving up.")
            self.setFailure()
            return
#         self.modellingResult = self.dataInput.saxsModelingResult

        # I don't trust in this authentication.... but it is going to work soon
        self.httpAuthenticatedToolsForBiosaxsWebService = HttpAuthenticated(username=user, password=password)
        self.client = Client(self.dataBioSaxsSample.ispybURL.value, transport=self.httpAuthenticatedToolsForBiosaxsWebService, cache=None)
コード例 #34
0
ファイル: client.py プロジェクト: Tethik/pybankid
 def __init__(self, **kwargs):
     self.cert = kwargs.pop('cert', None)
     self.verify_cert = kwargs.pop('verify_cert', None)
     # super won't work because HttpAuthenticated
     # does not use new style class
     HttpAuthenticated.__init__(self, **kwargs)
コード例 #35
0
ファイル: pycontrol.py プロジェクト: dlopes7/pycontrol
 def __init__(self, *args, **kwargs):
    HttpAuthenticated.__init__(self, *args, **kwargs)
コード例 #36
0
	def __init__(self, **kwargs):
		self.cert = kwargs.pop('cert', None)
		self.verify = kwargs.pop('verify', True)
		self.session = requests.Session()
		# super won't work because not using new style class
		HttpAuthenticated.__init__(self, **kwargs)
コード例 #37
0
ファイル: transport.py プロジェクト: SUNET/pynavet
 def __init__(self, **kwargs):
     self.cert = kwargs.pop('cert', None)
     self.verify = kwargs.pop('verify', True)
     # Can't pass this one on to HttpAuthenticated. Crashes on unknown attributes.
     kwargs.pop('debug', False)
     HttpAuthenticated.__init__(self, **kwargs)
コード例 #38
0
ファイル: transport.py プロジェクト: SUNET/pymmclient
 def __init__(self, **kwargs):
     self.cert = kwargs.pop('cert', None)
     self.verify = kwargs.pop('verify', True)
     HttpAuthenticated.__init__(self, **kwargs)
コード例 #39
0
ファイル: soap.py プロジェクト: humblejok/seq_common
 def __init__(self, **kwargs):
     self.cert = kwargs.pop('cert', None)
     # super won't work because not using new style class
     HttpAuthenticated.__init__(self, **kwargs)