Ejemplo n.º 1
0
 def __init__(self, limit, config_path):
     
     self.conn = db.connect(config_path)
     self.cursor = self.conn.cursor()
     self.url = "https://data.cityofchicago.org/resource/ijzp-q8t2.json"
     self.limit = limit
     config = parse(config_path)
     self.socrata_key = config["socrata.key"]
Ejemplo n.º 2
0
    def __init__(self, limit, config_path):

        self.conn = db.connect(config_path)
        self.cursor = self.conn.cursor()
        self.url = "https://data.cityofchicago.org/resource/ijzp-q8t2.json"
        self.limit = limit
        config = parse(config_path)
        self.socrata_key = config["socrata.key"]
Ejemplo n.º 3
0
def connect(config_path):
    '''Open database connection and return conn object to perform database queries'''
    config = parse(config_path)
    host = config['mysql.host']
    user = config['mysql.username']
    passwd = config['mysql.password']
    db = config['mysql.database']

    try:
        conn = MySQLdb.connect(host, user, passwd, db)
        return conn
    except MySQLdb.Error, e:
        print "ERROR %d IN CONNECTION: %s" % (e.args[0], e.args[1])
Ejemplo n.º 4
0
def run(pipe):
    # parse the config
    config = configParser.parse('manual.conf')['']
    
    # create a fifo
    if not exists(config['fifoPath']):
        os.mkfifo(config['fifoPath'])
    with open(config['fifoPath'], 'r') as f:
        while not f.closed:
            a = f.readline()
            if a != '':
                pipe.send(a.split(','))
            sleep(2)
Ejemplo n.º 5
0
def parseConfig():
    return configParser.parse('feed.conf')['']
Ejemplo n.º 6
0
from subprocess import call
import utils.configParser as configParser
from os.path import exists
from shutil import rmtree, copytree as rm, cp

# load the config
config = configParser.parse('sshfs.conf')['']

# mount the point (if necessary)
if call(['mountpoint', '-q', config['mountpoint']]): 
        call(['sshfs', '-oPort=' + config['port'], config['host'] + ':/', config['mountpoint']])

def procPkgInfo(PKGBUILD):
    '''
    grabs the pkvger and pkgname from the package
    '''
    for line in PKGBUILD.split("\n"):
        if strip(line) [:7] 

# now implement functions
def store(path, PKGBUILD):
    '''
    This function takes a path and a PKGBUILD string and moves it to its proper place in
    the storage subsystem.
    '''
    # ensure the mountpoint is still mounted
    if not call(['mountpoint', '-q', config['mountpoint']]):
        call(['sshfs', '-oPort=' + config['port'], config['host'], config['mountpoint']])

    # delete whats already there
    if exists(config['mountpoint'] + '/' + config['basedir'] + '/' + path.split('/')[-1]):