diff --git a/erepublik/access_points.py b/erepublik/access_points.py index ca76c4c..1d471d6 100644 --- a/erepublik/access_points.py +++ b/erepublik/access_points.py @@ -87,7 +87,9 @@ class SlowRequests(Session): body = "[{dt}]\tURL: '{url}'\tMETHOD: {met}\tARGS: {args}\n".format(dt=utils.now().strftime("%F %T"), url=url, met=method, args=args) - utils.write_file(self.request_log_name, body) + with open(self.request_log_name, 'ab') as file: + file.write(body.encode("UTF-8")) + pass def _log_response(self, url, resp, redirect: bool = False): from erepublik import Citizen @@ -111,8 +113,7 @@ class SlowRequests(Session): file_data.update({"ext": "html"}) filename = 'debug/requests/{time}_{name}{extra}.{ext}'.format(**file_data) - with open(utils.get_file(filename), 'wb') as f: - f.write(resp.text.encode('utf-8')) + utils.write_file(filename, resp.text) pass