def post_handler(response, i): dp = 'http://i0.kym-cdn.com/profiles/icons/big/000/132/880/awesome%20face%20shrug.jpg' rendered = render_file("pages/post.html", { "dp": dp, "meme": Meme.get_meme_from_id(i) }) response.write(rendered)
def nearby_handler(response): dp = 'fixme' photo_list = Meme.get_memes_for_category(3) rendered = render_file("pages/nearby.html", { "dp": dp, "photo_list": photo_list, }) response.write(rendered)
def nearby_handler(response): dp = 'https://www.transparenthands.org/wp-content/themes/transparenthands/images/donor-icon.png' photo_list = Meme.get_memes_for_category(3) rendered = render_file("pages/nearby.html", { "dp": dp, "photo_list": photo_list }) response.write(rendered)
def create_meme(user_id): usernameExists = User.query.filter_by(id=user_id).first() if not usernameExists: return json.dumps({ 'success': False, 'error': 'User does not exist!' }), 404 post_body = json.loads(request.data) template_id = post_body.get('template_id') text0 = post_body.get('text0') text1 = post_body.get('text1') font = post_body.get('font') name = post_body.get('name') print(name) #http://api.imgflip.com/caption_image?template_id=16464531&text0=when you're bad at everything&text1=hello&font="impact"&username=annabel48lin&password=helloworld toSend = 'http://api.imgflip.com/caption_image?' toSend += 'template_id=' + str(template_id) + '&' toSend += 'text0=' + text0 + '&' toSend += 'text1=' + text1 + '&' toSend += 'font=' + font + '&' toSend += 'username='******'&' toSend += 'password='******'success'] == True): meme = Meme(name=name, url=res.json()['data']['url'], creator_id=user_id) db.session.add(meme) db.session.commit() return json.dumps({'success': True, 'data': meme.serialize()}), 201 else: return json.dumps({ 'success': False, 'error': "@ios you did something wrong" }), 400
def feed_handler(response): dp = 'http://i0.kym-cdn.com/profiles/icons/big/000/132/880/awesome%20face%20shrug.jpg' photo_list = Meme.get_memes_for_category(3) check_upvotes_l = lambda x: check_upvote_l(x) imglink = "/post" time_func = lambda x: format_time(x) rendered = render_file( "pages/feed.html", { "dp": dp, "photo_list": photo_list, "imglink": imglink, "time_format": time_func, 'check_upvotes': check_upvotes_l }) response.write(rendered)
def photo_save(user: str, caption: str, lat: str, long: str, base64blob): "This function will take information about a photo and save it to a location." current_time = datetime.utcnow().isoformat() Meme.create_meme_post(base64blob, caption, lat, long, user, current_time, 3)