Пример #1
0
def account_info():
    token = session.get('google_token')[0]
    try:
        headers = {'Authorization': "OAuth {0}".format(token)}
        req = requests.get(GOOGLE_OAUTH_URL, headers=headers)
        response = req.json()
        user = User.lookup_by_google(response['id'])
        print(user.id)
        Announcement.make_announcement(
            user,
            "Balloons in Soda Courtyard",
            "Hey everyone, there are balloons in the soda courtyard right now. Like shit I'm tripping balls.",
            tags="balloons, fun time, soda hall, cs for lyfe")
        Announcement.make_announcement(user,
                                       "Hilfinger is in the Soda",
                                       "I repeat, the hilf is back.",
                                       tags="hilfinger, too, op")
        Announcement.make_announcement(
            user,
            "Classes canceled",
            "CS61A is canceled forever. BUT CS61B IS ALWAYS ON BABY",
            tags="what, testing, why tho")

        return jsonify(req.json())
    except requests.exceptions.RequestException:
        return "YOU F****D UP A-A-RON"