Your TypeError
should be enough to indicate that you're using the wrong IO class. Change:
path = io.StringIO(urllib.request.urlopen(url).read())
fpath = io.StringIO(urllib.request.urlopen(furl).read())
To
path = io.BytesIO(urllib.request.urlopen(url).read())
fpath = io.BytesIO(urllib.request.urlopen(furl).read())
And this should work for you.