diff options
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bs4/element.py b/bs4/element.py index 1f121f4..f6864f2 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1392,10 +1392,13 @@ class Tag(PageElement): def recursiveChildGenerator(self): return self.descendants - # This was kind of misleading because has_key() (attributes) was - # different from __in__ (contents). has_key() is gone in Python 3, - # anyway. - has_key = has_attr + def has_key(self, key): + """This was kind of misleading because has_key() (attributes) + was different from __in__ (contents). has_key() is gone in + Python 3, anyway.""" + warnings.warn('has_key is deprecated. Use has_attr("%s") instead.' % ( + key)) + return self.has_attr(key) # Next, a couple classes to represent queries and their results. class SoupStrainer(object): |