mikejs / python-duckduckgo

A library for querying the Duck Duck Go API
Other
79 stars 72 forks source link

Update the package to Python 3 #12

Open HGStyle opened 1 year ago

HGStyle commented 1 year ago

You literaly just need to replace only one line ! This line:

import urllib2

Need to be replaced by this line:

import urllib.request as urllib2

If you want that Python2 and Python3 are supported, replace the import urllib2 line by:

import sys
if int(sys.version_info[0]) > 2:
    import urllib.request as urllib2
else:
    import urllib2

Please, change this in the code, then republish the package on PyPI. Thanks !