In order to consume web service out of session I am generating an API and URL. But I am unable to consume the web service. It is working fine when I consume it in session. I have seen in the tutorials. But currently I am not seeing any results. My problem statement is forecasting let say voltage. In which I provide the number of units e.g. minute, day, hour etc for which we want the forecasting. I am attaching the snippets of code and error. I am using python 2.
Following is the code for in session consuming. Working fine.

Following is the code for getting API key and URL for out of session consumption.

Error