From 5960dd2ebd6e07082f5d7ee2ef5b1e7356c6845a0b106887392603d65acdf1a8 Mon Sep 17 00:00:00 2001 From: f4lco Date: Thu, 23 Apr 2020 12:41:27 +0200 Subject: [PATCH] Fix minor Python 3 renames and deprecations (#7) --- stw_potsdam/config.py | 6 +++--- stw_potsdam/views.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stw_potsdam/config.py b/stw_potsdam/config.py index 6503281..95e39f6 100644 --- a/stw_potsdam/config.py +++ b/stw_potsdam/config.py @@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*- -import ConfigParser +import configparser import io import os @@ -12,10 +12,10 @@ Canteen = namedtuple('Canteen', def _get_config(filename): - config = ConfigParser.SafeConfigParser() + config = configparser.ConfigParser() path = os.path.join(os.path.dirname(__file__), filename) with io.open(path, encoding='utf-8') as config_file: - config.readfp(config_file) + config.read_file(config_file) return config diff --git a/stw_potsdam/views.py b/stw_potsdam/views.py index 3363853..c340e71 100644 --- a/stw_potsdam/views.py +++ b/stw_potsdam/views.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- import os -import urlparse +import urllib.parse from flask import Flask, jsonify, make_response, url_for from flask.logging import create_logger @@ -21,7 +21,7 @@ app.url_map.strict_slashes = False log = create_logger(app) if 'BASE_URL' in os.environ: # pragma: no cover - base_url = urlparse.urlparse(os.environ.get('BASE_URL')) + base_url = urllib.parse.urlparse(os.environ.get('BASE_URL')) if base_url.scheme: app.config['PREFERRED_URL_SCHEME'] = base_url.scheme if base_url.netloc: @@ -33,7 +33,7 @@ cache = SimpleCache() def canteen_not_found(config, canteen_name): - log.warn('Canteen %s not found', canteen_name) + log.warning('Canteen %s not found', canteen_name) configured = ', '.join("'{}'".format(c) for c in config.keys()) message = "Canteen '{0}' not found, available: {1}".format(canteen_name, configured)