Merge pull request #1 from TNP-Ltd/fix-utf8-save

Prevent utf8 (e.g. emoji) breaking export
This commit is contained in:
David Leutgeb 2020-12-17 09:57:23 +01:00 committed by GitHub
commit 8145c22595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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']))