title: Determine if url is a pdf or html file
body: <p>I am requesting urls using the requests package in python (e.g. file = requests.get(url)).  The urls do not specify an extension in them, and sometimes a html file is returned and sometimes a pdf is returned.</p>
  <p>Is there a way of determining if the returned file is a pdf or a html, or more generally, what the file format is? The browser is able to determine, so I assume it must be indicated in the response.</p>