def home(): # http://stackoverflow.com/questions/15327776/python-django-avoid-saving-passwords-in-source-code FB_USERNAME = os.environ.get("FLIPBOARD_USERNAME", '') FB_PASSWORD = os.environ.get("FLIPBOARD_PASSWORD", '') f = Flipboard(FB_USERNAME, FB_PASSWORD) url = request.args['url'] title = request.args['title'] success = f.plus(url, title) return url + "=" + ('OK' if success else 'FAILED')
def test_get_csrf(self): html = open('fixtures/login.html', 'r') f = Flipboard() csrf = f.get_csrf(html) self.assertEqual(u'+3Q5PqP2xp8uUOPOFR5N0RvBSxU=|szdAibdBL8xtb7BqYTaX5ZM/mFwi1yKz4guehNTsDyLdm8GelpFLc/4L2S0gXTA5SEGxisNOi4T3AQtQrSEQcA==', csrf, 'incorrect csrf token')