2

I'm using ghost.py to get the output of an html page and render it to a png.

The page is on a node.js/express server and it needs authentication (with jwt)

The problem is that I can't understand if the headers are sent or not.

Here is a snippet to test it:

from ghost import Ghost
ghost = Ghost()

url = "myprotectedpage"
token = "myverylongjwttoken"
headers = {'Authorization': 'Bearer '+token}

with ghost.start(wait_timeout=10) as session:
    page, extra_resources = session.open(url,headers=headers)
    session.capture_to('test.png')

When I run this code I print the login page and not the actual page, the reason could be that the header is not sent to the page.

Any idea on how to figuring out what's wrong with headers or any other way to reach the protected resource? (for instance using cookielib to store a cookie on the ghost.py session)

Daniele P.
  • 228
  • 4
  • 16

0 Answers0