Пример #1
0
    def updateConfig(self, db_name, config):
        print "updating sync properties for this database"
        from ISUtils.process_utils import getConf

        f = open(getConf(os.path.abspath(__file__)), 'rb')
        c = json.loads(f.read())
        f.close()

        for key in config.keys():
            c[db_name][key] = config[key]

        f = open(getConf(os.path.abspath(__file__)), 'wb+')
        f.write(json.dumps(c))
        f.close()

        return c[db_name]
Пример #2
0
	def __init__(self):
		super(M2XDB, self).__init__()
		
		try:
			f = open(getConf(os.path.abspath(__file__)), 'rb')
			self.conf = json.loads(f.read())['M2X']
			f.close()
		except:
			self.conf = {}
			return
		
		try:
			self.is_active = self.conf['is_active']
		except KeyError as e:
			print "is_active not yet set for M2X.  using False as default"
			self.is_active = False
			
		self.url = "http://api-m2x.att.com/v1/feeds/%s" % self.conf['feed_id']
		self.header = {
			"X-M2X-KEY" : self.conf['api_key'],
			"Content-type" : "application/json",
			"Accept-Encoding" : "gzip, deflate",
			"User-Agent" : "python-m2x/%s" % version
		}
		self.timestamp_format = TIMESTAMP_FORMAT['iso8601']
Пример #3
0
	def updateConfig(self, db_name, config):
		print "updating sync properties for this database"
		from ISUtils.process_utils import getConf
		
		f = open(getConf(os.path.abspath(__file__)), 'rb')
		c = json.loads(f.read())
		f.close()
		
		for key in config.keys():
			c[db_name][key] = config[key]
		
		f = open(getConf(os.path.abspath(__file__)), 'wb+')
		f.write(json.dumps(c))
		f.close()
		
		return c[db_name]