JohnWarren1 / daily-image

Started as an experiment with Django. Evolving into a social media-esque project.
0 stars 0 forks source link

Get new image each day #6

Open JohnWarren1 opened 6 years ago

JohnWarren1 commented 6 years ago

custom command run by a cron job seems to be top recommendation

JohnWarren1 commented 6 years ago

below was run in python console to successfully pull an image down. Would require some changes to randomise which image is found, and check image hasn't been taken already:

img_data = requests.get(r['hits'][1]['webformatURL']).content with open('image_name.jpg', 'wb') as handler: handler.write(img_data)