First import of migration to python 3

This commit is contained in:
Martin Bley
2022-09-18 13:24:58 +02:00
parent 9d6857cfe2
commit 12323615c7
13 changed files with 491 additions and 479 deletions

View File

@@ -18,7 +18,13 @@
# You should have received a copy of the GNU General Public License
# along with TipPy. If not, see <http://www.gnu.org/licenses/>.
#
import sys, locale, suds, urllib2, psycopg2
import sys
import locale
from suds.client import Client
import urllib.request
import urllib.error
import urllib.parse
import psycopg2
class OpenLiga(object):
version = "0.1"
@@ -37,21 +43,21 @@ class OpenLiga(object):
# get a SUDS client object
if self.proxyurl is None:
try:
self.client = suds.client.Client(
self.client = Client(
'http://www.openligadb.de/'
+ 'Webservices/Sportsdata.asmx?WSDL')
except (urllib2.URLError):
except (urllib.error.URLError):
self.error += "Connect to webservice failed."
else:
try:
t = suds.transport.http.HttpTransport()
proxy = urllib2.ProxyHandler({'http':proxyurl})
opener = urllib2.build_opener(proxy)
proxy = urllib.request.ProxyHandler({'http':proxyurl})
opener = urllib.request.build_opener(proxy)
t.urlopener = opener
self.client = suds.client.Client(
'http://www.openligadb.de/Webservices/'
+ 'Sportsdata.asmx?WSDL', transport=t)
except urllib2.URLError as e:
except urllib.error.URLError as e:
self.error += "Connect to webservice failed " \
+ "(via proxy " + proxyurl + "): " + str(e) + "\n"