Created
June 4, 2016 21:39
-
-
Save mddub/f7245472afe44521b56dce6a35b5c4b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import random | |
from flask import Flask, request | |
app = Flask(__name__) | |
x = 0 | |
@app.route('/ShareWebServices/Services/General/LoginPublisherAccountByName', methods=['post']) | |
def login(): | |
token = ''.join(random.choice('abcdefghijklm') for _ in range(10)) | |
print "token:", token | |
return json.dumps(token) | |
@app.route('/ShareWebServices/Services/Publisher/ReadPublisherLatestGlucoseValues', methods=['post']) | |
def latest(): | |
global x | |
x += 1 | |
print x | |
if x % 3 == 0: | |
return json.dumps([{'Value': 30, 'Trend': 4, 'WT': '/Date(1462404576000)/'}]) | |
else: | |
return json.dumps({'Code': 'SessionNotValid'}) | |
if __name__ == "__main__": | |
app.run( | |
debug=True, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment