def header_images(): # Can only retrieve 19 images, 5 at a max time. images = [] images.extend(get_latest_header_images(0)["images"]) images.extend(get_latest_header_images(5)["images"]) images.extend(get_latest_header_images(10)["images"]) images.extend(get_latest_header_images(15, num=4)["images"]) return Response(json.dumps(images), content_type="application/json")
def header_images(): # Can only retrieve 19 images, 5 at a max time. images = [] images.extend(get_latest_header_images(0)["images"]) images.extend(get_latest_header_images(5)["images"]) images.extend(get_latest_header_images(10)["images"]) images.extend(get_latest_header_images(15, num=4)["images"]) return Response( json.dumps( images ), content_type="application/json")
def header_images(): idx = request.args.get("idx", 0, type=int) num = request.args.get("num", 5, type=int) return Response( json.dumps( get_latest_header_images(idx, num) ), content_type="application/json")
def download_latest_image(output="static/header.jpg"): latest_headers = bing_images.get_latest_header_images() img = latest_headers["images"][0] bing_images.download_to(img["url"], output) return img
def header_images(): idx = request.args.get("idx", 0, type=int) num = request.args.get("num", 5, type=int) return Response(json.dumps(get_latest_header_images(idx, num)), content_type="application/json")