first of all check if the module is installed
from tenet:
for py2
opkg install python-requests
for py3
opkg install python3-requests
but... my edited file plugin.py no have this compliance:
# import urllib
# import urllib.request
this is paused ;)
and this plugin.py are only test.. sorry ..
i have added a code
Python
PY3 = False
import sys
if sys.version_info[0] >= 3:
PY3 = True
unicode = str
unichr = chr
long = int
from urllib.error import HTTPError, URLError
from urllib.request import urlopen, Request, urlretrieve
else:
from urllib2 import HTTPError, URLError
from urllib2 import urlopen, Request
from urllib import urlretrieve
Display More
and
Code
import six
if six.PY3:
import urllib.request as urllib2
import http.cookiejar as cookielib
else:
import urllib2
import cookielib
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'}
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
req = urllib2.Request("http://api.buienradar.nl/data/forecast/1.1/all/" + str(citynumb), data=None, headers=headers)
handler = urllib2.urlopen(req, timeout=15)
antw = handler.read()
Display More
feedback is definitely required for the test, I don't want any, I tried to make it work on my 2 boxes (py2-py3)
thank's Caught