Skip to content

Instantly share code, notes, and snippets.

@iambibhas
Created February 10, 2013 05:48
Show Gist options
  • Select an option

  • Save iambibhas/4748546 to your computer and use it in GitHub Desktop.

Select an option

Save iambibhas/4748546 to your computer and use it in GitHub Desktop.
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
img_temp = NamedTemporaryFile(delete=True)
img_temp.write(urllib2.urlopen(url).read())
img_temp.flush()
im.file.save(img_filename, File(img_temp))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment