Skip to content

Commit

Permalink
Fixed UnicodeDecodeError
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaetano Perrone committed Mar 2, 2020
1 parent ed2826b commit 8db99b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PageRenderAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def render_page_with_phantom(method, url, body, headers, cookies, pageEvents=Fal

output = {}

page_html = base64.b64decode(rendered_page_output['html']).decode(u)
try:
page_html = base64.b64decode(rendered_page_output['html']).decode(u)
except UnicodeDecodeError as e:
page_html = base64.decodebytes(bytes(rendered_page_output['html'], u))
output['page_html'] = page_html

page_errors = base64.b64decode(rendered_page_output['errors']).decode(u)
Expand Down

0 comments on commit 8db99b7

Please sign in to comment.