It happend to me a few times the last week, urllib that acts up for some reason.
req = urllib.request.Request(oauth_uri)
req.add_header('User-Agent', "Python client")
resp = urllib.request.urlopen(req, bytes_)
data = resp.read().decode("utf-8")
It works, then it says req = urllib.request.Request(oauth_uri)
AttributeError: module 'urllib' has no attribute 'request'
and then it as sudden as it acts up, it works again.
Does anyone know how this happens and how to solve it? I need it to function reliable.