def __init__(self,flist=None): self._config = ConfigParser.ConfigParser() # self._config.read("/opt/bookworm/settings/settings.cfg") self._config.read(os.getcwd() + "/settings/settings.cfg") ll = self._config.get("general","logging").upper() self._log = utility.logger(self.__class__.__name__,ll) self._kword_amt = self._config.get("feeder","keyword_amount") mhost = self._config.get("db_mongo", "host") mport = self._config.get("db_mongo", "port") mdb = self._config.get("db_mongo", "database") mcollection = self._config.get("db_mongo", "collection") self._mongodb_handle = mongodb(mhost,mport,mdb,mcollection) self._mdb = self._mongodb_handle.get_con() self._processed = [] if flist == None: self._fl_loc = self._config.get("feeder","feed_list") self._log.debug("Grabbing feed file: %s" % self._fl_loc) self._feed_list = open(self._fl_loc,"r") else: self._log.debug("Using passed in feed file") self._feed_list = open(flist,"r") self.process_feed()
def __init__(self, flist=None): self._config = ConfigParser.ConfigParser() # self._config.read("/opt/bookworm/settings/settings.cfg") self._config.read(os.getcwd() + "/settings/settings.cfg") ll = self._config.get("general", "logging").upper() self._log = utility.logger(self.__class__.__name__, ll) self._kword_amt = self._config.get("feeder", "keyword_amount") mhost = self._config.get("db_mongo", "host") mport = self._config.get("db_mongo", "port") mdb = self._config.get("db_mongo", "database") mcollection = self._config.get("db_mongo", "collection") self._mongodb_handle = mongodb(mhost, mport, mdb, mcollection) self._mdb = self._mongodb_handle.get_con() self._processed = [] if flist == None: self._fl_loc = self._config.get("feeder", "feed_list") self._log.debug("Grabbing feed file: %s" % self._fl_loc) self._feed_list = open(self._fl_loc, "r") else: self._log.debug("Using passed in feed file") self._feed_list = open(flist, "r") self.process_feed()
def __init__(self, host, port, db=False, logging="_"): self._log = utility.logger("jetplane", logging) self._host = host self._port = port self._proxy_ip = None self._whois_handle = Client() self._criteria = None self._max_tours = 0 self._tours = 1 self._takeoff_time = None self._errors = 0 self._success = False self._trip_details = [] self._db = db self._kill_bit = False if self._db: self._mongodb_handle = mongodb("127.0.0.1", "27017", "jetplane", "hanger", "INFO") self._mdb = self._mongodb_handle.get_con()
import hashlib import time db_settings = { "host": "localhost", # Set to localhost for localhost. Not used with sqlite3. "port": 27017, # Set to 27017 for mongodb default. Not used with sqlite3." "data_file": "db_tornadobb", # Set database file for mongodb "max_pool_size": 10, # default connection pool size } db_conn = Connection(db_settings['host'], db_settings['port'], db_settings['max_pool_size']) database = db_conn[db_settings["data_file"]] db = mongodb(db_settings) m = hashlib.md5() m.update("123456") passowrd = m.hexdigest().upper() user = { 'name': "disong", 'password': passowrd, 'email': "*****@*****.**", 'last_login': time.time(), "registered_time": time.time(), } category_obj_1 = { "name": "Pictures", "position": 1,
from mongodb import * import hashlib import time db_settings = { "host": "localhost", # Set to localhost for localhost. Not used with sqlite3. "port": 27017, # Set to 27017 for mongodb default. Not used with sqlite3." "data_file":"db_tornadobb", # Set database file for mongodb "max_pool_size":10, # default connection pool size } db_conn = Connection(db_settings['host'], db_settings['port'],db_settings['max_pool_size']) database = db_conn[db_settings["data_file"]] db = mongodb(db_settings) m = hashlib.md5() m.update("123456") passowrd = m.hexdigest().upper() user = { 'name' : "disong", 'password': passowrd, 'email' : "*****@*****.**", 'last_login':time.time(), "registered_time":time.time(), } category_obj_1 = {"name":"Pictures","position":1,"des":"pic","closed":False} category_obj_2 = {"name":"Video","position":1,"des":"video","closed":False}