예제 #1
0
def login(request):
    data = request.get_json()
    username = data[ACCOUNT_LOGIN_USERNAME]
    password = data[ACCOUNT_LOGIN_PASSWORD]
    if login_to_api(username, password):
        return respond(200)
    return respond(460)
예제 #2
0
def return_bike(request):
    data = request.get_json()
    bike_no = data[BIKE_NUMBER]
    station = data[STATION_NUMBER]
    comment = data[COMMENT]
    response = post({'action': 'return', 'bike_no': bike_no, 'new_return_street': '', 'return_place_id': station, 'city_id': session[SESSION_CITY], 'finallat': '', 'finallng': '', 'end_street2': comment})
    return respond(401)
예제 #3
0
def history():
    account_history = get_history()
    if account_history:
        return respond(200, account_history=account_history)
    return respond(401)
예제 #4
0
def logged():
    if SESSION_AUTH_TOKEN in session:
        return respond(200)
    return respond(401)
예제 #5
0
def logout():
    session.clear()
    return respond(200)
예제 #6
0
def rent_bike(request):
    data = request.get_json()
    bike_no = data[BIKE_NUMBER]
    response = post({'action': 'look_up', 'bike_no': bike_no, 'quick': 1})
    return respond(401)
예제 #7
0
def list_bikes():
    response = get()
    return respond(401)
예제 #8
0
def unlock(request):
    data = request.get_json()
    bike_no = data[BIKE_NUMBER]
    response = post({'action': 'look_up', 'bike_no': bike_no, 'open_rack': 1})
    return respond(401)
예제 #9
0
def get_all():
    client = pymongo.MongoClient()
    db = client['bikeathand']
    cursor = db.stations.find({}, {'_id': False})
    stations = json.loads(json_util.dumps(cursor))
    return respond(200, stations=stations)