Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
save image from link.
#2
I got a not found from the url you supplied.
I would use requests module to fetch image, something like:
(using different image)

import requests
from io import open as iopen

def fetch_image(img_ur, save_filename):
    img = requests.get(img_ur)
    if img.status_code == 200:
        with iopen(save_filename, 'wb') as f:
            f.write(img.content)
    else:
        print('Received error: {}'.format(img.status_code))

testlink = 'https://vignette.wikia.nocookie.net/pdsh/images/9/95/Prettygoldilocks.jpg'

filename = 'Goldilocks.jpg'
fetch_image(testlink, filename)
Reply


Messages In This Thread
save image from link. - by mr_byte31 - Jan-22-2018, 01:31 PM
RE: save image from link. - by Larz60+ - Jan-22-2018, 07:21 PM
RE: save image from link. - by mr_byte31 - Jan-22-2018, 09:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to save to multiple locations during save cubangt 1 592 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  Save image from outlook email cubangt 1 736 Jun-07-2023, 06:52 PM
Last Post: cubangt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020