title: python exception within if and try block
body: <p>I'm writing a python client to a web-service (REST) using requests</p>
  
  <p>I want to raise except with the user enters bad credentials</p>
  
  <p>I have the following code block</p>
  
  <pre><code>    try:
          ret=self.req_session.get(URL)
          if (ret.status_code == 401):
              raise Authexecption("Improper credentials")
          else:
              ret.raise_for_status()               
      except Authexecption:
          logging.error("Unable to authenticate. Please check you credentails")
      except requests.exceptions.HTTPError:
          logging.error("Issue with communicating with Web-Services. The HTTP response is " + str(ret.status_code))
      except requests.exceptions.Timeout:
          logging.error("Time out while connecting to the Web-Service..")
  </code></pre>
  
  <p>The Idea here being, that I will raise a custom error message for auth issues, and a generic one for all other issues (5xx,404 etc..)</p>
  
  <p>when I execute this I get the following error</p>
  
  <pre><code>    except Authexecption:
  NameError: global name 'Authexecption' is not defined
  </code></pre>
  
  <p>I'm pretty new to python and trying to learn, how do i fix this?</p>
  
  <p>-Thanks in advance</p>