I want to integrate an invoice api on python with zeep library. When I create Client object and send request with client.service.Login, Python is giving error Missing element SESSION_ID (LoginRequest.REQUEST_HEADER). I think the invoice api needs REQUEST_HEADER parameter with SESSION_ID in it. But how can i make it successfully. Any help will be appreciated.
import zeep
import requests
wsdl = 'URL'
client = zeep.Client(wsdl=wsdl)
client.service.Login('username','password')
ValidationError: Missing element SESSION_ID (LoginRequest.REQUEST_HEADER)
Okay I solved the problem. I only created dictionary with session_id
and then passed this dictionary as a parameter to the Login
function:
import zeep
import requests
wsdl = 'URL'
client = zeep.Client(wsdl=wsdl)
data = {'SESSION_ID':'0'}
session_id = client.service.Login(data, 'username', 'password')
print(session_id)
Output:
'SESSION_ID': 'xxxx-xxxx-xxxx.....',
'ERROR_TYPE': None