title: how to get headers from urllib2.read() written in django's NamedTemporaryFile?
body: <p>Im trying to use django's NamedTemporaryFile for storing instace from urllib. Here are some codes.</p>
  
  <pre><code>import urllib2
  import types
  
  from django.core.files.temp import NamedTemporaryFile    
  img_temp = NamedTemporaryFile()
  img_temp = urllib2.urlopen('http://www.python.org/images/python-logo.gif').read()
  img_temp.write(img_temp)
  </code></pre>
  
  <p>How can I get the header from img_temp? The img_temp variable is a string. And what is the difference between this two codes? Why do they return different types?</p>
  
  <pre><code>a = urllib2.urlopen('http://www.python.org/images/python-logo.gif')
  a.read()
  b = urllib2.urlopen('http://www.python.org/images/python-logo.gif').read()
  
  print 'a %s'% type(a)
  print 'b %s'% type(b)
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>a &lt;type 'instance'&gt;
  b &lt;type 'str'&gt;
  </code></pre>
  
  <p>Thanks :)</p>