I am a total Python novice and am trying to convert someone elses code from PY2 to PY3 that downloads some xml code and converts it, I am stuck on how to replace the AppUrlOpener
Towards the start there is
class AppUrlOpener(urllib.request.FancyURLopener):
"""Set user agent for downloads
"""
version = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'
And further down
urllib.request._urlopener = AppUrlOpener()
I have tried replacing with
urllib.request._urlopener = urlopen()
but it tells me to use newer urlopen functions/methods.
Any suggestions what to try