change from python to python3

This commit is contained in:
Julian Wöhrer 2022-01-01 23:02:47 +01:00
parent 5ebbaba6f1
commit d3da277d4f
15 changed files with 75 additions and 73 deletions

View file

@ -14,8 +14,8 @@ httpRequest-Plugin to dispatch FMS-, ZVEI- and POCSAG - messages to an URL
#
# Imports
#
import urllib
import urllib2
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import logging # Global logger
from includes import globalVars # Global variables
@ -73,8 +73,8 @@ def run(typ,freq,data):
#
dataCopy = dict(data)
for key in dataCopy:
if isinstance(dataCopy[key], basestring):
dataCopy[key] = urllib.quote(dataCopy[key])
if isinstance(dataCopy[key], str):
dataCopy[key] = urllib.parse.quote(dataCopy[key])
#
# Get URLs
#
@ -100,10 +100,10 @@ def run(typ,freq,data):
for url in urls:
try:
urllib2.urlopen(url)
except urllib2.HTTPError as e:
urllib.request.urlopen(url)
except urllib.error.HTTPError as e:
logging.warning("HTTP response: %s", e.code)
except urllib2.URLError as e:
except urllib.error.URLError as e:
logging.warning("HTTP-specific error: %s", e.args)
except: