Example #1
0
    def SetupClient(wurl,
                    auth,
                    toAddToken=True,
                    toImportMsgSrc=True,
                    toImportArrSrc=False):
        if toImportMsgSrc:
            # update WSDL (xsd)
            msgImport = Import('http://api.eyeblaster.com/message')
            if toImportArrSrc:
                arrImport = Import(
                    'http://schemas.microsoft.com/2003/10/Serialization/Arrays'
                )
                doctor = ImportDoctor(msgImport, arrImport)
            else:
                doctor = ImportDoctor(msgImport)
            client = Client(wurl, doctor=doctor, faults=False)
        else:
            client = Client(wurl, faults=False)

        if toAddToken:
            # update token into SOAP header
            header = ('ns1', 'http://api.eyeblaster.com/message')
            element = Element('UserSecurityToken',
                              ns=header).setText(auth.token)
            client.set_options(soapheaders=element)
        return client
def load_crb_standards(license_num, date):
    # loads values of standards (aka normativs) which are binding on russian banks
    # license_num -- int value
    # date -- string 'yyyy-mm-ddT00:00:00+03:00'
    #    e.g. July, 1 2016 --> '2016-07-01T00:00:00+03:00'
    # this data is available for the fist days of each month
    # returns pandas data frame with values of standards for chosen bank & date
    url = 'http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL'
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
    imp.filter.add('http://web.cbr.ru/')
    imp = Import('http://www.w3.org/2001/XMLSchema',
                 location='http://www.w3.org/2001/XMLSchema.xsd')
    imp.filter.add('http://web.cbr.ru/')
    doctor = ImportDoctor(imp)

    client = Client(url, doctor=doctor)
    tmp = client.service.Data135FormFull(license_num, date)
    norms = tmp.diffgram.F135DATA.F135_3
    df = pd.DataFrame()
    for i in range(len(norms)):
        ind_name = norms[i].C3
        try:
            ind_value = norms[i].V3
        except AttributeError:
            ind_value = None
        df_tmp = pd.DataFrame({
            'Indicator_name': [ind_name],
            'Indicator_value': [ind_value]
        })
        df = df.append(df_tmp, ignore_index=True)

    return df
Example #3
0
    def _get_creatives_client(self):
        self.logon(self.username, self.password, 'Publisher')

        wsdl_url = self.url + '/PublisherCreative.svc?wsdl'

        schema_url = 'http://affilinet.framework.webservices/Svc'
        schema_import = Import(schema_url)
        schema_doctor = ImportDoctor(schema_import)

        schema_doctor.add(Import('http://affilinet.framework.webservices/types/PublisherCreative'))
        schema_doctor.add(Import('http://schemas.microsoft.com/2003/10/Serialization/Arrays'))

        client = SudsClient(url=wsdl_url, doctor=schema_doctor)
        return client
Example #4
0
def getclient(axlver):
    tns = 'http://schemas.cisco.com/ast/soap/'
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/',
                 'http://schemas.xmlsoap.org/soap/encoding/')
    imp.filter.add(tns)
    location = 'https://' + ip + ':8443/axl/'
    # This block checks the path you are in and uses the axlsqltoolkit
    # under the path of the script location.
    fileDir = os.path.dirname(os.path.realpath('__file__'))
    rel_path = 'axlsqltoolkit/schema/' + str(axlver) + '/AXLAPI.wsdl'
    fullfilepath = os.path.join(fileDir, rel_path)
    # If it's Windows we need to fix the backslashes to forward slashes.
    normalizedfilepath = fullfilepath.replace('\\', '/')
    # Join the file path depending on the system
    if platform.system() == 'Windows':
        wsdl = 'file:///' + normalizedfilepath
    else:
        wsdl = 'file://' + normalizedfilepath
    try:
        client = Client(wsdl, location=location, faults=False,
                        plugins=[ImportDoctor(imp)],
                        username=user, password=pwd)
    except Exception:
        print "Error with version or IP address of server. Please try again."
        sys.exit()
    return client
Example #5
0
def selectcmdevice(cucm,
                   username=None,
                   password=None,
                   SelectBy="Name",
                   Class="Any",
                   Status="Any",
                   NodeName="Any"):
    tns = 'http://schemas.cisco.com/ast/soap/'
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/',
                 'http://schemas.xmlsoap.org/soap/encoding/')
    imp.filter.add(tns)

    wsdl = "https://%s:8443/realtimeservice/services/RisPort?wsdl" % cucm
    location = "https://%s:8443/realtimeservice/services/RisPort" % cucm
    client = Client(wsdl,
                    location=location,
                    username=username,
                    password=password,
                    plugins=[ImportDoctor(imp)])
    result = client.service.SelectCmDevice(
        '', {
            'SelectBy': SelectBy,
            'Status': Status,
            'Class': Class,
            'NodeName': NodeName
        })

    return result['SelectCmDeviceResult']['TotalDevicesFound'], result[
        'SelectCmDeviceResult']['CmNodes']
Example #6
0
def holdseats():
    imp = Import('http://www.w3.org/XML/1998/namespace',
                 location='http://*****:*****@xyz.com"
    contactInfo.Phone = "99877778"
    contactInfo.Mobile = "09999988988"
    arrayOfPassenger = client.factory.create('ArrayOfPassenger')
    passenger = client.factory.create('Passenger')
    passenger.Name = 'shekhar'
    passenger.Age = '25'
    passenger.Gender = 'M'
    passenger.SeatNo = 'S5'
    passenger.Fare = '200'
    passenger.SeatType = 'ac'
    passenger.IsAcSeat = '1'
    arrayOfPassenger.Passenger.append(passenger)
    result = client.service.HoldSeatsForSchedule(authentication, 123, '', 123,
                                                 contactInfo, arrayOfPassenger)
    print result.content
Example #7
0
    def request(self, start_date, end_date):
        imp = Import('http://theaffiliategateway.com/data/schemas')
        client = Client(self.url, doctor=ImportDoctor(imp), cache=NoCache())

        authentication = client.factory.create('AuthenticationType')
        authentication.username = self.username
        authentication.apikey = self.password

        criteria = client.factory.create('CriteriaType')

        criteria.StartDateTime = start_date.isoformat() + ' 00:00:00'
        criteria.EndDateTime = end_date.isoformat() + ' ' + '00:00:00'

        result = client.service.GetSalesData(authentication, criteria)

        data = []
        if result.Transactions:
            for transaction in result.Transactions.Transaction:
                entry = dict()
                for field in transaction:
                    entry[field[0]] = field[1]
                data.append(entry)

        output = pandas.DataFrame()
        if len(data) > 0:
            output = output.append(data, ignore_index=True)
            output = output.rename(columns=lambda x: 'ag:' + x)

        return output
Example #8
0
    def __init__(self, username, password, wsdl, cucm, cucm_version=10):
        """
        :param username: axl username
        :param password: axl password
        :param wsdl: wsdl file location
        :param cucm: UCM IP address
        :param cucm_version: UCM version
        """
        self.username = username
        self.password = password
        self.wsdl = wsdl
        self.cucm = cucm
        self.cucm_version = cucm_version

        tns = 'http://schemas.cisco.com/ast/soap/'
        imp = Import('http://schemas.xmlsoap.org/soap/encoding/',
                     'http://schemas.xmlsoap.org/soap/encoding/')
        imp.filter.add(tns)

        t = HttpAuthenticated(username=self.username, password=self.password)
        t.handler = urllib.request.HTTPBasicAuthHandler(t.pm)

        ssl_def_context = ssl.create_default_context()
        ssl_def_context.check_hostname = False
        ssl_def_context.verify_mode = ssl.CERT_NONE

        t1 = urllib.request.HTTPSHandler(context=ssl_def_context)
        t.urlopener = urllib.request.build_opener(t.handler, t1)

        self.client = Client(self.wsdl,
                             location='https://{0}:8443/axl/'.format(cucm),
                             faults=False,
                             plugins=[ImportDoctor(imp)],
                             transport=t)
Example #9
0
def login(request):
    if request.method == 'POST':
        try:
            user = request.POST['user'].strip()
            pwd = request.POST['pwd'].strip()
        except:
            return HttpResponseBadRequest()
        from django.contrib.auth import authenticate, login
        auth = authenticate(username = user , password = pwd)
        if auth is not None:
           login(request, auth)
           return HttpResponse()
        else:
            url = 'http://ws.espol.edu.ec/saac/wsandroid.asmx?WSDL' #http://ws.espol.edu.ec/saac/wsandroid.asmx?WSDL
            imp = Import('http://www.w3.org/2001/XMLSchema')
            imp.filter.add('http://tempuri.org/')
            doctor = ImportDoctor(imp)
            client = Client(url, doctor=doctor)
            auth = client.service.autenticacion(user,pwd)
            if auth == True:
                auth = User.objects.create_user(username=user, password=pwd)
                auth.save()
                auth = authenticate(username = user , password = pwd)
                login(request, auth)
                return HttpResponse()
            else:
                return HttpResponseBadRequest()
    else:
        return HttpResponseBadRequest()
Example #10
0
    def __init__(self):
        self.url = 'https://swedishspeciesobservation.artdatabankensoa.se/SwedishSpeciesObservationService.svc?singleWsdl'
        self.usr = '******'
        self.pw = 'Hack4Swe2'
        self.appIdent = 'HackForSweden'
        self.session = ''
        self.wci = ''
        self.token = ''

        imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
        imp.filter.add('ArtDatabanken.WebService.Data')
        doctor = ImportDoctor(imp)
    
        try:
            self.client = Client(self.url, doctor=doctor, retxml=True)
            res = self.client.service.Login(self.usr, self.pw, self.appIdent, 0)
            if(res):
                print("*** Logged in successfully. ***")
                self.session = xmltodict.parse(res)
                self.wci = self.client.factory.create(
                    'ns1:WebClientInformation')
                self.token = self.session['s:Envelope']['s:Body']['LoginResponse']['LoginResult']['a:Token']
                self.wci['Token'] = self.token
        except WebFault as e:
            print("*** Error loggin in: ", e)
            exit(1)

        except Exception as e:
            print("Error creating client: ", e)
            exit(1)
Example #11
0
 def adddoctor(self, schema=None, xsd=None, namespace=None):
     imp = Import(schema, location=xsd)
     # 指定命名空间
     imp.filter.add(namespace)
     self.doctor = ImportDoctor(imp)
     self.writer.write(self.writer.row, 7, 'PASS')
     self.writer.write(self.writer.row, 8, str(self.wsdl))
Example #12
0
    def __init__(self, username, password, cucm, cucm_version):
        """
        :param username: ris username
        :param password: ris password
        :param cucm: UCM IP address
        :param cucm_version: UCM version

        example usage:
        >>> from ris import RIS
        >>> ucm = RIS('ris_user', 'ris_pass', '192.168.200.10', '11.5')
        """
        self.username = username
        self.password = password
        self.wsdl = 'https://'+cucm+':8443//realtimeservice2/services/RISService70?wsdl'
        self.cucm = cucm
        self.cucm_version = cucm_version


        tns = 'http://schemas.cisco.com/ast/soap/'
        imp = Import('http://schemas.xmlsoap.org/soap/encoding/', 'http://schemas.xmlsoap.org/soap/encoding/')
        imp.filter.add(tns)

        t = HttpAuthenticated(username=self.username, password=self.password)
        t.handler = urllib.request.HTTPBasicAuthHandler(t.pm)
        
        ssl_def_context = ssl.create_default_context()
        ssl_def_context.check_hostname = False
        ssl_def_context.verify_mode = ssl.CERT_NONE

        t1 = urllib.request.HTTPSHandler(context=ssl_def_context)
        t.urlopener = urllib.request.build_opener(t.handler, t1)

        self.client = Client(self.wsdl, location='https://{0}:8443/realtimeservice2/services/RISService70'.format(cucm), faults=False,
                             plugins=[ImportDoctor(imp)],
                             transport=t)
Example #13
0
 def __init__(self, url):
     #下面的3行为了解决下面的错误 suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'
     imp = Import('http://www.w3.org/2001/XMLSchema',
                  location='http://www.w3.org/2001/XMLSchema.xsd')
     imp.filter.add('http://WebXml.com.cn/')
     doctor = ImportDoctor(imp)
     self.client = Client(url, doctor=doctor)
Example #14
0
def weatherclient():
    url = 'http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl'
    imp = Import('http://www.w3.org/2001/XMLSchema',
                 location='http://www.w3.org/2001/XMLSchema.xsd')
    imp.filter.add('http://WebXml.com.cn/')
    client = Client(url, plugins=[ImportDoctor(imp)])
    return client
    def _cron_update(self):
        # Get current date to get exchange rate for today
        currentDate = datetime.datetime.now().date()
        today = currentDate.strftime('%d/%m/%Y'); #formato requerido por el BCCR dd/mm/yy

        # Get XML Schema for BCCR webservice SOAP
        imp = Import('http://www.w3.org/2001/XMLSchema', location='http://www.w3.org/2001/XMLSchema.xsd')
        imp.filter.add('http://ws.sdde.bccr.fi.cr')

        # Web Service Connection using the XML schema from BCCRR
        client = Client('http://indicadoreseconomicos.bccr.fi.cr/indicadoreseconomicos/WebServices/wsIndicadoresEconomicos.asmx?WSDL', doctor=ImportDoctor(imp))

        # Get Selling exchange Rate from BCCR
        # Indicators IDs at https://www.bccr.fi.cr/seccion-indicadores-economicos/servicio-web
        # The response is a string we need to convert it to XML to extract value
        response = client.service.ObtenerIndicadoresEconomicosXML(tcIndicador='318', tcFechaInicio=today, tcFechaFinal=today, tcNombre='AKUREY', tnSubNiveles='N')
        xmlResponse = xml.etree.ElementTree.fromstring(response)
        rateNodes = xmlResponse.findall("./INGC011_CAT_INDICADORECONOMIC/NUM_VALOR")
        sellingRate = 0
        if len(rateNodes) > 0:
            sellingOriginalRate = float(rateNodes[0].text)
            sellingRate = 1/sellingOriginalRate # Odoo utiliza un valor inverso. Es decir a cuantos dólares equivale 1 colón. Por eso se divide 1 colon entre el tipo de cambio. 

        # Get Buying exchange Rate from BCCR
        response = client.service.ObtenerIndicadoresEconomicosXML(tcIndicador='317', tcFechaInicio=today, tcFechaFinal=today, tcNombre='AKUREY', tnSubNiveles='N')
        xmlResponse = xml.etree.ElementTree.fromstring(response)
        rateNodes = xmlResponse.findall("./INGC011_CAT_INDICADORECONOMIC/NUM_VALOR")
        buyingRate = 0
        if len(rateNodes) > 0:
            buyingOriginalRate = float(rateNodes[0].text)
            buyingRate = 1/buyingOriginalRate # Odoo utiliza un valor inverso. Es decir a cuantos dólares equivale 1 colón. Por eso se divide 1 colon entre el tipo de cambio. 

        # Save the exchange rate in database
        newRate = self.create({'name': currentDate.isoformat(),'rate': sellingRate, 'original_rate':sellingOriginalRate, 'rate_2':buyingRate, 'original_rate_2':buyingOriginalRate, 'currency_id': 3})
Example #16
0
 def __init__(self, **kwargs):
     kwargs['_'] = None
     if hasattr(ssl, '_create_unverified_context'):
         ssl._create_default_https_context = ssl._create_unverified_context
     self.server = kwargs.get('server', False) or (input('CUCM address: '))
     self.location = 'https://' + self.server + ':8443/axl/'
     self.username = kwargs.get('username', False) or \
                     input('AXL Username: '******'password', False) or \
                     getpass('Password for %s: ' % self.username)
     self.imp = Import('http://schemas.xmlsoap.org/soap/encoding/',
                       'http://schemas.xmlsoap.org/soap/encoding/')
     self.imp.filter.add(TNS)
     self.readonly = kwargs.get('readonly', True)
     self.client = Client(WSDL_PATH,
                          location=self.location,
                          faults=False,
                          plugins=[ImportDoctor(self.imp)],
                          username=self.username,
                          password=self.password)
     # Test Connection
     try:
         response = self.client.service.getCCMVersion()
         validate_axlresp(response)
         if VER not in str(response[1]['return'].componentVersion.version):
             logline('WARNING: CUCM version is ' +
                     '%s, this script is using %s AXL schema.' %
                     (response[1]['return'].componentVersion.version, VER))
     except Exception as e:
         logline('%s: %s' % (type(e).__name__, e))
         raise
Example #17
0
class webs:
    # add the Import Tag in wsdl
    imp = Import('http://www.w3.org/2001/XMLSchema',
                 location='http://www.w3.org/2001/XMLSchema.xsd')
    imp.filter.add("http://WebXml.com.cn/")
    d = ImportDoctor(imp)
    # ------------------------------------------------------------
    # China weather predict in three days (webservice url)
    try:
        web_url = 'http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl'
        client = suds.client.Client(web_url, doctor=d)

    except:
        print 'url is error'

    # ----------------------------------------------------------------------------
    # set FUNCTION
    def __init__(self):
        self.client = client
        self.method_name = method_name

    def get_all_methods(self, client):  # 查询本webservice所有的方法
        return [method for method in client.wsdl.services[0].ports[0].methods]

    def get_method_args(self, client, method_name):  # 查询本webservice所有方法调用的参数
        method = client.wsdl.services[0].ports[0].methods[method_name]
        input_params = method.binding.input
        return input_params.param_defs(method)

    interfaces = get_all_methods(self, client)
    print 'There are interfaces what we got :\n', interfaces
    print '-------------------------------------------------------------------------------------------'

    def get_all_method_args(self):  # 查询接口所有方法调用的参数
        for method_name in interfaces:
            print get_method_args(client, method_name)

    cli_ser = client.service

    # calling interface---------------------------------------------------------------------------------
    def ProvinceAre(self):  # 查询天气预报支持的所有省份
        print cli_ser.getSupportProvince()

    def CityAre(self):  # 查询天气预报支持的国内外的城市
        p = raw_input('Please input a ProvinceName in Cinese:\n')
        byProvinceName = p
        print cli_ser.getSupportCity(p)

    def DataSetAre(self):  # 查询本天气预报支持的所有数据信息
        print cli_ser.getSupportDataSet()

    def WeatherInfo(self):  # 查询未来3天内某城市的天气状况和生活指数
        c = raw_input('Please input a CityName in Chinese:\n')
        theCityName = c
        # print cli_ser.getWeatherbyCityName(c)
        output = tuple(cli_ser.getWeatherbyCityName(c))
        for i in output:
            for j, k in enumerate(i[1]):
                print j, k
Example #18
0
def get_client(hostname,
               wsdl_name,
               username='******',
               password='******',
               cachedir=None,
               verify=False,
               timeout=90,
               port=443):
    """Returns and instance of suds.client.Client.

    A separate client is used for each iControl WSDL/Namespace (e.g.
    "LocalLB.Pool").

    This function allows any suds exceptions to propagate up to the caller.

    @param hostname: The IP address or hostname of the BIGIP.
    @param wsdl_name: The iControl namespace (e.g. "LocalLB.Pool")
    @param username: The admin username on the BIGIP.
    @param password: The admin password on the BIGIP.
    @param cachedir: The directory to cache wsdls in. None indicates
        that caching should be disabled.
    @param verify: When True, performs SSL certificate validation in
        Python / urllib2 versions that support it (v2.7.9 and newer)
    @param timeout: The time to wait (in seconds) before timing out
        the connection to the URL
    """
    url = 'https://%s:%s/iControl/iControlPortal.cgi?WSDL=%s' % (
        hostname, port, wsdl_name)
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
    imp.filter.add('urn:iControl')

    if cachedir is not None:
        cachedir = ObjectCache(location=os.path.expanduser(cachedir), days=1)

    doctor = ImportDoctor(imp)
    if verify:
        client = Client(url,
                        doctor=doctor,
                        username=username,
                        password=password,
                        cache=cachedir,
                        timeout=timeout)
    else:
        transport = HTTPSTransportNoVerify(username=username,
                                           password=password,
                                           timeout=timeout)
        client = Client(url,
                        doctor=doctor,
                        username=username,
                        password=password,
                        cache=cachedir,
                        transport=transport,
                        timeout=timeout)

    # Without this, subsequent requests will use the actual hostname of the
    # BIGIP, which is often times invalid.
    client.set_options(location=url.split('?')[0])
    client.factory.separator('_')
    return client
Example #19
0
 def adddoctor(self, s=None, x=None, n=None):
     imp = Import(s, location=x)
     # 指定命名空间
     imp.filter.add(n)
     self.doctor = ImportDoctor(imp)
     self.writer.write(self.writer.row, 7, 'PASS')
     self.writer.write(self.writer.row, 8, '')
     return True
Example #20
0
def web_interfa(url, interface):
    imp = Import('http://www.w3.org/2001/XMLSchema',
                 location='http://www.w3.org/2001/XMLSchema.xsd')
    imp.filter.add("http://WebXml.com.cn/")
    d = ImportDoctor(imp)
    page1 = Client("%s?wsdl" % url, autoblend=True, doctor=d)
    resul = page1.service.getAreaDataSet()
    return resul
Example #21
0
 def __init__(self, user, password, api_url=None):
     self.user = user
     self.password = password
     self.api_url = api_url if api_url else 'https://ideone.com/api/1/service.wsdl'
     self._import = Import('http://schemas.xmlsoap.org/soap/encoding/')
     self._doctor = ImportDoctor(self._import)
     self.client = Client(self.api_url, doctor=self._doctor)
     self._language_dict = None
Example #22
0
def buildclient():
    imp = Import("http://www.w3.org/2001/XMLSchema",
                 location="http://www.w3.org/2001/XMLSchema.xsd")
    imp.filter.add("http://WebXml.com.cn/")
    doctor = ImportDoctor(imp)
    url = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl"
    client = Client(url, doctor=doctor)
    return client.service
def axl_request():
    phone_list = []

    #Disable HTTPS certificate validation check - not recommended for production
    if hasattr(ssl, '_create_unverified_context'):
        ssl._create_default_https_context = ssl._create_unverified_context

    tns = 'http://schemas.cisco.com/ast/soap/'
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
    imp.filter.add(tns)

    # adding the ip address provided onto the url link for the API call
    url = 'https://' + user_env.CUCM_LOCATION + '/axl/'

    # connecting to CUCM device using axl
    axl = Client(
        "file:///Users/jbanegas/Repos/cisco_cucm_AXL_phone_inventory_flask_sample/app/schema/AXLAPI.wsdl",
        location=url,
        faults=False,
        plugins=[ImportDoctor(imp)],
        username=user_env.CUCM_USER,
        password=user_env.CUCM_PASSWORD)

    list_of_devices = []

    # axl api call being made and filter name with any devices that start with SEP (all phones)
    # refer to AXL documentation to see the more phone info you can receive with returnedTags

    res = axl.service.listPhone({'name': "SEP%"},
                                returnedTags={
                                    'name': '',
                                    'description': '',
                                    'model': '',
                                    'networkLocation': '',
                                    'product': '',
                                    'class': '',
                                    'protocol': '',
                                    'protocolSide': '',
                                    'callingSearchSpaceName': '',
                                    'devicePoolName': '',
                                    'commonDeviceConfigName': '',
                                    'commonPhoneConfigName': '',
                                    'networkLocation': '',
                                    'locationName': ''
                                })

    # verifying if the response was successful
    if (res[0] == 200):
        if res[1]['return']:

            phones = res[1]['return']['phone']

            for phone in list(phones):
                phone_list.append(phone)
    else:
        ("Response Error from AXL API Call")

    return phone_list
def rev_aff_aw(start_date, end_date, aw_pw):
    # api_key = '18809dd6e20dffe282ce7616ac94c8ce'
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
    d = ImportDoctor(imp)
    url = 'http://api.affiliatewindow.com/v6/AffiliateService?wsdl'
    client = Client(url, doctor=d)
    auth = client.factory.create('UserAuthentication')
    auth.iId = '215843'
    auth.sPassword = aw_pw
    auth.sType = 'affiliate'
    client.set_options(soapheaders=auth)
    #
    json = client.service.getTransactionList(dStartDate = start_date.isoformat(), \
                                             dEndDate = end_date.isoformat(), sDateType = 'transaction')
    # json mapping
    w = pd.DataFrame()
    for Transaction in json.getTransactionListReturn[0]:
        x = []
        x = [
        Transaction.sStatus[0],\
        Transaction.sClickref[0],\
        Transaction.iMerchantId[0],\
        Transaction.dClickDate[0],\
        Transaction.dTransactionDate[0],\
        Transaction.mCommissionAmount[0].dAmount[0],\
        Transaction.mSaleAmount[0].dAmount[0]]
        v = pd.DataFrame(data=[x])
        w = w.append(v)
    col = [
        'status',\
        'customID',\
        'merchantID',\
        'clickTime',\
        'date',\
        'commissionValue',\
        'orderValue']
    w.columns = col
    w.insert(0, 'affiliateNetwork', 'affiliateWindow', allow_duplicates=True)
    # convert string date
    w = w.reset_index(drop=True)
    for i in range(len(w['clickTime'])):
        try:
            w.loc[i, 'clickTime'] = dateutil.parser.parse(
                w['clickTime'][i]).strftime('%d/%m/%Y')
        except:
            pass
        try:
            w.loc[i, 'date'] = dateutil.parser.parse(
                w['date'][i]).strftime('%d/%m/%Y')
        except:
            pass
    aw = w
    # add merchant name
    aw_merchant = pd.read_csv('./data/merchant_name/aw_merchantName.csv',
                              dtype=object)
    aw = aw.merge(aw_merchant, how='left', left_on='merchantID', right_on='id')
    aw.drop('id', axis=1, inplace=True)
    return aw
Example #25
0
    def adddoctor(self, s='', n=''):
        # 使用suds.client创建一个客户端,用来请求webservice服务器
        imp = Import('http://www.w3.org/2001/XMLSchema', location=s)
        imp.filter.add(n)
        self.doctor = ImportDoctor(imp)

        self.writer.write(self.writer.row, self.writer.clo, "PASS")
        self.writer.write(self.writer.row, self.writer.clo + 1,
                          str(self.doctor))
Example #26
0
    def connection(self):
        """establish a connection with MailCertificado"""

        namespace = 'urn:MailcertificadoWS/types/'

        imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
        imp.filter.add(namespace)
        doctor = ImportDoctor(imp)
        return Client(self.url, location=self.location, doctor=doctor)
Example #27
0
 def __init__(self):
     imp = Import('http://www.w3.org/2001/XMLSchema', location='http://www.w3.org/2001/XMLSchema.xsd')
     imp.filter.add('http://schemas.microsoft.com/2003/10/Serialization/')
     imp.filter.add('http://schemas.microsoft.com/2003/10/Serialization/Arrays')
     imp.filter.add('http://schemas.datacontract.org/2004/07/LKQIntegrationService.Core.Entities')
     imp.filter.add('http://schemas.datacontract.org/2004/07/LKQIntegrationService.Core.Ordering.Entities')
     imp.filter.add('LKQCorp.LKQIntegrationService')
     doctor = ImportDoctor(imp)
     self.client = Client('https://lkqintegration.ekeyconnect.com/Ordering.svc?singleWsdl', doctor=doctor)
Example #28
0
    def __init__(self, service_name, login, private_key_file='decrypted_key', endpoint='api.transip.nl'):
        self.service_name = service_name
        self.login = login
        self.private_key_file = private_key_file
        self.endpoint = endpoint
        self.url = URI_TEMPLATE.format(endpoint, service_name)

        imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
        doc = ImportDoctor(imp)
        self.soap_client = SudsClient(self.url, doctor=doc)
Example #29
0
 def __init__(self, wsdl_host, wsdl_api, ssl=False, cert=None, **params):
     imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
     doctor = ImportDoctor(imp)
     session = Session()
     session.verify = cert or ssl
     self._wsdl_api = wsdl_api
     wsdl = "%s%s" % (wsdl_host, wsdl_api)
     self._client = Client(
         wsdl, doctor=doctor, transport=RequestsTransport(session))
     self._params = params
Example #30
0
	def __init__(self, Credentials):
		self.Credentials = Credentials
		imp = Import('http://www.w3.org/2001/XMLSchema', location='http://www.w3.org/2001/XMLSchema.xsd')
		imp.filter.add('http://api.sellercloud.com/')
		doctor=ImportDoctor(imp)
		self.cl = Client(self.Credentials['WSDL'], doctor=doctor)
		self.auth = self.cl.factory.create('AuthHeader')
		self.auth.UserName = self.Credentials['UserName']
		self.auth.Password = self.Credentials['Password']
		self.cl.set_options(soapheaders=self.auth)