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
def relay_request(headers, data): url = properties.get('RELAY_URL') requests.post(url, json.dumps(data), headers=headers)
def __init__(self): self.connection = redis.StrictRedis(host=properties.get('REDIS_HOST'), port=int( properties.get('REDIS_PORT')))
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()
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()
def auth_git(): return git(properties.get("GITHUB_USERNAME"), properties.get("GITHUB_PASSWORD"), timeout=3000)
def auth_git(): return git(properties.get('GITHUB_USERNAME'), properties.get('GITHUB_PASSWORD'), timeout=3000)
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))
def __init__(self): self.connection = redis.StrictRedis(host=properties.get('REDIS_HOST'), port=int(properties.get('REDIS_PORT')))