tomasbedrich / pycaching

A Python 3 interface for working with Geocaching.com website.
https://pycaching.readthedocs.io/
GNU Lesser General Public License v3.0
61 stars 46 forks source link

beautifulsoup4: The 'text' argument to find()-type methods is deprecated #189

Closed FriedrichFroebel closed 1 year ago

FriedrichFroebel commented 2 years ago

It seems like we are currently using some deprecated beautifulsoup4 parameters:

test/test_geocaching.py::TestShortcuts::test_get_cache_by_guid
  /home/me/pycaching/.env/lib/python3.10/site-packages/bs4/element.py:784: DeprecationWarning: The 'text' argument to find()-type methods is deprecated. Use 'string' instead.
    warnings.warn(
FriedrichFroebel commented 2 years ago

The renaming happened in version 4.4.0:

The text argument to the find_* methods is now called string, which is more accurate. text still works, but string is the argument described in the documentation. text may eventually change its meaning, but not for a very long time.

The deprecation warning has been introduced in version 4.11.0:

Some time ago, the misleadingly named "text" argument to find-type methods was renamed to the more accurate "string." But this supposed "renaming" didn't make it into important places like the method signatures or the docstrings. That's corrected in this version. "text" still works, but will give a DeprecationWarning.

See the changelog at https://bazaar.launchpad.net/%7Eleonardr/beautifulsoup/bs4/view/head:/CHANGELOG.

As we require beautifulsoup4 ~= 4.9, id est beautifulsoup4 >= 4.9, == 4.*, we should be safe to replace the offending sections.