From 6e5ebc265a712786e199284af3fa3b7e48dbd57f Mon Sep 17 00:00:00 2001 From: Ruan Chaves Date: Sat, 10 Mar 2018 11:55:56 -0300 Subject: [PATCH] Fixed codec bug This fixes a codec bug in this script. Presently as it stands it won't run and exit with a fatal error. --- get_fb_posts_fb_page.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/get_fb_posts_fb_page.py b/get_fb_posts_fb_page.py index 812a074..64587bb 100644 --- a/get_fb_posts_fb_page.py +++ b/get_fb_posts_fb_page.py @@ -2,6 +2,7 @@ import datetime import csv import time +import codecs try: from urllib.request import urlopen, Request except ImportError: @@ -23,7 +24,8 @@ def request_until_succeed(url): success = False while success is False: try: - response = urlopen(req) + reader = codecs.getreader("utf-8") + response = reader(urlopen(req)) if response.getcode() == 200: success = True except Exception as e: