from zeep import Client
client = Client('https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2017-10-01')
token_type = client.get_type('ns0:AccessToken')
token = token_type(TokenValue=‘my-token-goes-here’)
result = client.service.GetDepartureBoard(3, "NSG", "MOG", None, None, None,
_soapheaders=[token])
<?xml version='1.0' encoding='utf-8'?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Header><ns0:TokenValue xmlns:ns0="http://thalesgroup.com/RTTI/2013-11-28/Token/types">my-token-goes-here</ns0:TokenValue></soap-env:Header><soap-env:Body><ns0:GetDepartureBoardRequest xmlns:ns0="http://thalesgroup.com/RTTI/2017-10-01/ldb/"><ns0:numRows>3</ns0:numRows><ns0:crs>NSG</ns0:crs><ns0:filterCrs>MOG</ns0:filterCrs></ns0:GetDepartureBoardRequest></soap-env:Body></soap-env:Envelope>
token_construct = xsd.Element(
'{http://thalesgroup.com/RTTI/2013-11-28/Token/types}AccessToken',
xsd.ComplexType([
xsd.Element(
'{http://thalesgroup.com/RTTI/2013-11-28/Token/types}TokenValue',
xsd.String()),
])
)
token = token_construct(TokenValue='my-token-goes-here')
<ns0:AccessToken xmlns:ns0="http://thalesgroup.com/RTTI/2013-11-28/Token/types"><ns0:TokenValue>my-token-goes-here</ns0:TokenValue></ns0:AccessToken>