Prevent utf8 (e.g. emoji) breaking export

This commit is contained in:
Dan Poltawski 2020-08-05 21:03:50 +01:00
parent 6907acc82a
commit ec7aada1ed

View File

@ -42,7 +42,7 @@ for book in books_data_data:
book_html = requests.get(export_url, headers=header, verify=cert_verify_url) book_html = requests.get(export_url, headers=header, verify=cert_verify_url)
with open(export_file_name, "w+") as file: with open(export_file_name, "w+") as file:
file.write(book_html.text) file.write(book_html.text.encode('utf8'))
print("Successfully exported book {}".format(book['name'])) print("Successfully exported book {}".format(book['name']))