title: Python requests library Exception handling
body: <p>I am creating a download service using the python requests library (See <a href="http://docs.python-requests.org/en/latest/" rel="noreferrer" title="Requests: HTTP for Humans">here</a>) to download data from another server. The problem is that sometimes I get a <code>503 error</code> and I need to display an appropriate message. See sample code below:</p>
  
  <pre><code>import requests
  s = requests.Session()
  response = s.get('http://mycustomserver.org/download')
  </code></pre>
  
  <p>I can check from <code>response.status_code</code> and get the <code>status code = 200</code>.
  But how do I <code>try/catch</code> for a specific error, in this case, I want to be able to detect <code>503 error</code> and handle them appropriately. </p>
  
  <p>How do I do that?</p>