def midi_learn(mindwave, midi): try: app = App(mindwave, midi) app.send_dummy() except: pass
def run(mindwave, midi): try: app = App(mindwave, midi) app.run() except: pass
def main(): client = pymongo.MongoClient() from controller import App app = App(client.zephyr, "cms.nasa.gov") instances = list(app.get_instances()) print get_instance_monthly_cost(instances) dbs = list(app.get_dbs()) print get_db_monthly_cost(dbs)
def main(): logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("github.relsync") user, password = GH_CRED.split(":", 1) gh = github3.login(user, password=password) client = pymongo.MongoClient() org = gh.organization(GH_ORG) app_names = App.get_apps(client.zephyr) db_releases = client.zephyr.app_releases db_commits = client.zephyr.release_commits repos = list(org.iter_repos()) for r in repos: if r.name in app_names: print "Found", r.name for t in r.iter_tags(): r_tag = db_releases.find_one({"_id": t.commit['sha']}) if r_tag is not None: continue log.info("Syncing release %s", t.name) d = t._json_data d['_id'] = d['commit']['sha'] d['app'] = r.name db_releases.insert(d) log.info("Syncing commits %s", t.name) commits = r.iter_commits(d['_id'], number=10) for c in commits: cd = c._json_data cd['_id'] = cd['sha'] try: db_commits.insert(cd, upsert=True) except pymongo.errors.DuplicateKeyError: continue
def apps(): apps = App.get_apps(db) return render_template('apps-index.j2', apps=sorted(apps))
#!/usr/bin/python3 # -*- coding: utf-8 -*- from sys import argv from controller import App App(argv)
from controller import App from helpers import parse_post_params, is_correct_query_params, our_signature, pay from settings import ip_white_list, required_query_params, password application = App(ip_white_list) @application.register_handler('^/uniteller_api_v1/$', ['POST']) def uniteller_url_handler(environ, url_params): try: length = int(environ.get('CONTENT_LENGTH', '0')) except: return b'412: Need a content', 412, {} else: post_params = parse_post_params(environ['wsgi.input'], length) print(post_params) if not is_correct_query_params(post_params, required_query_params): return b'412: BAD PARAMS', 412, {} if not our_signature(post_params, password, required_query_params): return b'403: Forbidden', 403, {} return pay(post_params)