I have resolved the issue, the problem is with my python script which is mixed with spaces and tabs.I have used only tabs for sub statements and issue resolved:
class SessionKeyAuth(AuthBase):
def __init__(self,**args):
self.auth_url = args['auth_url']
pass
def __call__(self, r):
if not 'X-HP3PAR-WSAPI-SessionKey' in r.headers:
#perform auth
credentials = {'user':'<username>','password':'<password>'}
req_args = {"verify" : False}
headers = {'content-type': 'application/json'}
auth_response = requests.post(self.auth_url,data=json.dumps(credentials),headers=headers,**req_args)
response_json = json.loads(auth_response.text)
session_key = response_json["key"]
r.headers['X-HP3PAR-WSAPI-SessionKey'] = session_key
return r
Use only spaces or only tabs in python script.
... View more