title: Displaying/getting Images from an URL in Python
body: <p>I am new to python. But I got a task and I need to Displaying/getting Images from an URL. 
  I have been using Jupyter notebook with python to try to do this.</p>
  
  <pre><code>import sys
  print(sys.version)
  3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
  </code></pre>
  
  <p>I was trying to do it as in <a href="https://stackoverflow.com/questions/7391945/how-do-i-read-image-data-from-a-url-in-python#7391991">this post</a> but none of the answers work.</p>
  
  <p>With</p>
  
  <pre><code>import urllib, cStringIO
  
  file = cStringIO.StringIO(urllib.urlopen(URL).read())
  img = Image.open(file)
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>ImportError                               Traceback (most recent call last)
  &lt;ipython-input-33-da63c9426dad&gt; in &lt;module&gt;()
        1 url='http://images.mid-day.com/images/2017/feb/15-Justin-Bieber.jpg'
        2 print(url)
  ----&gt; 3 import urllib, cStringIO
        4 
        5 file = cStringIO.StringIO(urllib.urlopen(URL).read())
  
  ImportError: No module named 'cStringIO'
  </code></pre>
  
  <p>With:</p>
  
  <pre><code>from PIL import Image
  import requests
  from io import BytesIO
  
  response = requests.get(url)
  img = Image.open(BytesIO(response.content))
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-11-168cd6221ea3&gt; in &lt;module&gt;()
        1 #response = requests.get("https://baobab-poseannotation-appfile.s3.amazonaws.com/media/project_5/images/images01/01418849d54b3005.o.1.jpg")
  ----&gt; 2 response.read("https://baobab-poseannotation-appfile.s3.amazonaws.com/media/project_5/images/images01/01418849d54b3005.o.1.jpg").decode('utf-8')
        3 img = Image.open(StringIO(response.content))
  
  AttributeError: 'Response' object has no attribute 'read'
  </code></pre>
  
  <p>With:</p>
  
  <pre><code>from PIL import Image
  import requests
  from StringIO import StringIO
  
  response = requests.get(url)
  img = Image.open(StringIO(response.content))
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ImportError                               Traceback (most recent call last)
  &lt;ipython-input-37-5716207ad35f&gt; in &lt;module&gt;()
        3 from PIL import Image
        4 import requests
  ----&gt; 5 from StringIO import StringIO
        6 
        7 response = requests.get(url)
  
  ImportError: No module named 'StringIO'
  </code></pre>
  
  <p>Etc....</p>
  
  <p>I thought it was going to be an easy task, but so far I haven't been able to find an answer.
  I really hope someone can help me</p>