def get_singlerate(self, base, code):
        """Get a single rate, used as fallback"""
        try:
            url = self.onerate_url % (base, code)
            resp = get(url)
            resp.raise_for_status()
        except exceptions.HTTPError as e:
            self.log(logging.ERROR, "%s: problem with %s:\n%s", self.name, url, e)
            return None
        rate = resp.text.rstrip()

        if rate == 'N/A':
            raise RuntimeError("%s: %s not found" % (self.name, code))
        else:
            return Decimal(rate)
def get_singlerate ( self , base , code ) : try : url = self . onerate_url % ( base , code ) resp = get ( url ) resp . raise_for_status ( ) except exceptions . HTTPError as e : self . log ( logging . ERROR , "%s: problem with %s:\n%s" , self . name , url , e ) return None rate = resp . text . rstrip ( ) if rate == 'N/A' : raise RuntimeError ( "%s: %s not found" % ( self . name , code ) ) else : return Decimal ( rate )
Get a single rate, used as fallback