siznax/wptools

Python 3.9 Deprecation Warning: 'encoding'

ukanuk opened this issue · 1 comments

After running through the readme and installing via pip install wptools, running get_parse() raises a deprecation warning that'encoding' is ignored and deprecated and will be removed.

I'm running Python 3.8.2 32-bit on Win 10 v1909.

>>> import wptools
>>> page = wptools.page('Gandhi')
>>> page.get_parse()
en.wikipedia.org (parse) Gandhi

Warning (from warnings module):
  File "C:\Program Files (x86)\Python38-32\lib\site-packages\wptools\utils.py", line 95
    return json.loads(data, encoding='utf-8')
DeprecationWarning: 'encoding' is ignored and deprecated. It will be removed in Python 3.9
en.wikipedia.org (imageinfo) File:Mahatma-Gandhi, studio, 1931.jpg

Warning (from warnings module):
  File "C:\Program Files (x86)\Python38-32\lib\site-packages\wptools\utils.py", line 95
    return json.loads(data, encoding='utf-8')
DeprecationWarning: 'encoding' is ignored and deprecated. It will be removed in Python 3.9
Mahatma Gandhi (en) data
{
  image: <list(1)> {'kind': 'parse-image', 'file': 'File:Mahatma-G...
  infobox: <dict(29)> honorific_prefix, name, office, term, nation...
  iwlinks: <list(8)> https://commons.wikimedia.org/wiki/Special:Se...
  pageid: 19379
  parsetree: <str(359143)> <root><template><title>Short descriptio...
  requests: <list(2)> parse, imageinfo
  title: Mahatma Gandhi
  wikibase: Q1001
  wikidata_url: https://www.wikidata.org/wiki/Q1001
  wikitext: <str(283423)> {{Short description|Pre-eminent leader o...
}
<wptools.page.WPToolsPage object at 0x04FBD748>

Thank you for noting this @ukanuk. Will add to next milestone.