how does it convert from str to float?

0

I have the following code:

#!/usr/bin/env python
from suds.client import Client
import time
import json


class ClassName(object):


    fecha = time.strftime('%Y-%m-%d')

    def trm(self, fecha):
        try:
            wsdl_url = 'https://www.superfinanciera.gov.co/SuperfinancieraWebServiceTRM/TCRMServicesWebService/TCRMServicesWebService?WSDL'
            client = Client(wsdl_url, location=wsdl_url, faults=True)
            trm =  client.service.queryTCRM(fecha)
            response = json.dumps(trm.value)
            rate = float(response)
        except Exception as e:
            return str(e)

        return rate

    print trm('rate')
    print type(trm('rate'))

the result is:

   TypeError: trm() takes exactly 2 arguments (1 given)
    
asked by 23.09.2018 в 04:04
source

1 answer

0

I do not know why you use the first "self" argument if you're not in a class The error tells you that the function takes 2 arguments and you only give it date Let's get rid of self

    
answered by 23.09.2018 в 21:59