please add a comment:
# This first tries to fill the header based on the API key.  If that fails, the 'catch' function fills in the header based on the session token.