title: Check for binary content with Python requests library
body: <p>Looking at the <a href="http://docs.python-requests.org/en/latest/user/quickstart/#raw-response-content" rel="noreferrer">requests documentation</a>, I know that I can use response.content for binary content (such as a .jpg file) and response.text for a regular html page. However, when the source is an image, and I try to access r.text, the script hangs. How can I determine in advance if the response contains html?</p>
  
  <p>I have considered checking the url for an image extension, but that does not seem fool-proof.</p>