Пример #1
0
def check_db():
    r.connect(properties.get('RETHINK_HOST'), properties.get('RETHINK_PORT')).repl()
    
    if 'relayr' in r.db_list().run():
        return True

    return False
Пример #2
0
def relay_request(headers, data):
    url = properties.get('RELAY_URL')
    requests.post(url, json.dumps(data), headers=headers)
Пример #3
0
 def __init__(self):
     self.connection = redis.StrictRedis(host=properties.get('REDIS_HOST'),
                                         port=int(
                                             properties.get('REDIS_PORT')))
Пример #4
0
def create_db():
    r.connect(properties.get('RETHINK_HOST'), properties.get('RETHINK_PORT')).repl()

    r.db_create('relayr').run()
    r.db('relayr').table_create('requests').run()
Пример #5
0
from config import properties

import rethinkdb as r
import json
import sys

r.connect(properties.get('RETHINK_HOST'), properties.get('RETHINK_PORT')).repl()

def get_requests():
    pass

def save_request(headers, js):
    lhead = {}
    for k,v in headers:
        lhead[k] = v
    json_structured = {}
    for k,v in js.iteritems():
        json_structured[k] = v
    doc = {'headers': lhead, 'data': json.dumps(js), 'structured': json_structured}
    r.db('relayr').table('requests').insert(doc).run()
    
Пример #6
0
def auth_git():
    return git(properties.get("GITHUB_USERNAME"), properties.get("GITHUB_PASSWORD"), timeout=3000)
Пример #7
0
def auth_git():
    return git(properties.get('GITHUB_USERNAME'),
               properties.get('GITHUB_PASSWORD'),
               timeout=3000)
Пример #8
0
import redis 
from config import properties
from model import Issue

redis_connection = redis.StrictRedis(host=properties.get('REDIS_HOST'), port=int(properties.get('REDIS_PORT')))


def retrieve_view(key, start=0, stop=4):
    return map(lambda x: obj_from_key(x), redis_connection.lrange(key, start, stop))

def obj_from_key(key):
    if "issue:" in key or "pull:" in key:
        return Issue().from_dict(redis_connection.hgetall(key))

Пример #9
0
 def __init__(self):
     self.connection = redis.StrictRedis(host=properties.get('REDIS_HOST'), port=int(properties.get('REDIS_PORT')))