def __init__(self, configdict, section): HttpInput.__init__(self, configdict, section) self.base_url = self.url self.url = None self.feature_idx = 0 self.next_timestamp = -1 self.feature_info = dict()
def init(self): # Connect only once to DB log.info('Init: connect to DB') self.db = PostGIS(self.cfg.get_dict()) self.db.connect() # Let superclass read file list from Apache URL HttpInput.init(self)
def __init__(self, configdict, section, produces=FORMAT.record_array): HttpInput.__init__(self, configdict, section, produces) # Init all device id's self.device_ids = [] self.device_ids_idx = -1 self.device_id = -1 # Save the Base URL, specific URLs will be constructed in self.url later self.base_url = self.url self.url = None
def read_from_url(self, url, parameters=None): """ Read the data from the URL, override to catch Exception without exiting process. :param url: the url to fetch :param parameters: optional dict of query parameters :return: """ if len(self.sensor_items) == 0: log.info('Fetch data from URL: %s ...' % url) try: data = HttpInput.read_from_url(self, url, parameters) except Exception as e: log.error( 'Error RawSensorAPIInput.read_from_url %s: e=%s, skip bbox...' % (url, str(e))) data = None if data is None: return None # Parse JSON from data string fetched by base method read() self.sensor_items = self.parse_json_str(data) self.sensor_item = self.next_entry(self.sensor_items) # Everything is fine return self.sensor_item
def __init__(self, configdict, section, produces=FORMAT.record): HttpInput.__init__(self, configdict, section, produces) self.query = self.cfg.get('query') self.db = None
def __init__(self, configdict, section, produces=FORMAT.record): HttpInput.__init__(self, configdict, section, produces)