コード例 #1
0
ファイル: wagerserver.py プロジェクト: kolonen/surprise
def load_wagers():
    credentials = flask.request.get_json(force=True)
    s = wc.login(credentials['username'], credentials['password'])
    wagers = wc.get_wagers(s)
    saved = 0
    for w in wagers:
        if db.save_wager(w) > 0:
            saved += 1
    message_json = json.dumps({'loadedWagers' : str(len(wagers)), 'savedWagers': str(saved)}, indent=4)
    return flask.Response(message_json, status=200, mimetype='application/json')
コード例 #2
0
ファイル: run_client.py プロジェクト: kolonen/surprise
import sys
sys.path.append("../server")
import surprise
import wager_client as wc
import database
import requests
import json
import time


if __name__ == "__main__":    
    s = wc.login(sys.argv[1], sys.argv[2])
    wagers = wc.get_wagers(s)
    db = database.database()
    for w in wagers:
        db.save_wager(w)
    
    w = db.get_wagers(50, 0)[0]
    print w.wager_id
    print w.wager_date
    for e in w.events:
        print e.home_team, e.away_team, e.home_score, e.away_score