From 8a238685c21357fc6b4ad4934808908a142edf73 Mon Sep 17 00:00:00 2001 From: Vaibhav Date: Wed, 10 Oct 2018 01:16:00 -0300 Subject: [PATCH] Update for Python3 support --- app.py | 3 +-- joke.py | 4 ++-- requirements.txt | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 340f9db..fa32c38 100644 --- a/app.py +++ b/app.py @@ -7,8 +7,7 @@ app = Flask(__name__) api = Api(app) -reload(sys) -sys.setdefaultencoding('utf-8') + CORS(app) diff --git a/joke.py b/joke.py index 5bcdae9..f787200 100644 --- a/joke.py +++ b/joke.py @@ -9,8 +9,8 @@ def random_digits(joke_count): def get_joke(): # Return random joke - with open('data.json') as data_file: + with open('data.json', encoding="utf8") as data_file: data = json.load(data_file) joke = data[random_digits(len(data))] - print joke + print(joke) return joke diff --git a/requirements.txt b/requirements.txt index 05950f1..360e0a6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -Flask==0.11.1 -gunicorn==19.7.0 -httplib2==0.9.2 -Jinja2==2.8 -virtualenv==15.1.0 -Werkzeug==0.11.10 +Flask==1.0.2 +gunicorn==19.9.0 +httplib2==0.11.3 +Jinja2==2.10 +virtualenv==16.0.0 +Werkzeug==0.14.1 flask-restful flask-cors==3.0.6