title: Beautifulsoup and Soupstrainer for getting links dont work with hasattr, returning always true
body: <p>i am using Beautifulsoup4 and Soupstrainer with Python 3.3 for getting all links from a webpage. The following is the important code-snippet:</p>
  
  <pre><code>r = requests.get(adress, headers=headers)
  for link in BeautifulSoup(r.text, parse_only=SoupStrainer('a')):
      if hasattr(link, 'href'):
  </code></pre>
  
  <p>I tested some webpages and it works very well but today when using</p>
  
  <pre><code>adress = 'http://www.goldentigercasino.de/'
  </code></pre>
  
  <p>I recognized that hasattr(link, 'href') always returns TRUE even when there is no such 'href' field, like in the goldentigercasino.de example.
  Because of that im getting troubles for late using link['href'] because its simply not there.</p>
  
  <p>I also tried a workaround like this:</p>
  
  <pre><code>test = requests.get('http://www.goldentigercasino.de/')
  for link in BeautifulSoup(test.text, parse_only=SoupStrainer('a',{'href': not None})):
  </code></pre>
  
  <p>That works as wanted Except that it also returns the Doctype:</p>
  
  <pre><code>HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
  </code></pre>
  
  <p>Which is causing also trouble for the same reasons as above.</p>
  
  <p>My question: Why does hasattr always returns true and how can I fix that? And if there is no possibility with hasattr, how can i fix my workaround that its not returning the DOCTYPE?</p>
  
  <p>Many Thanks and best regards!</p>