def getUSACPI(self): tf = '%s/%s/%s' % (self.ib.shareDir,self.tgtDir,self.ib.usacpifile) rc = fu.get_url_data(url_usa, tf) self.log.debug('url_usa = tf %s ' % tf) if rc == 'SUCCESS' : self.log.info('Created file %s ' % tf) return 0 else : self.log.error('Issue Creating %s - %s' % (tf,rc)) return 1
def getCanCPI(self): lf = '%s/%s/cancpi%s.html' % (self.ib.shareDir,self.landDir, self.ts) tf = '%s/%s/%s' % (self.ib.shareDir,self.tgtDir,self.ib.cancpifile) self.log.debug('landing file = %s target file = %s' % (lf,tf)) rc = fu.get_url_data(url_can, lf) if rc == 'SUCCESS' : self.log.info('Created temp file %s ' % lf) d = px.parseCanCPI(lf) if len(d) < 1 : self.log.warn('No data was retrieved for Canada') rc = 2 else: self.log.debug('data len %s from %s' % (len(d),lf) ) rc = fu.createFile(tf, d) self.log.debug('Create file %s rc =%s ' % (tf,rc)) else : self.log.error('%s ' % rc) rc = 1 return rc