Open Trolldemorted opened 6 months ago
I'm having the same problem. Can you specify WHERE you replace xsd:time with xsd:string? I don't have that in my code so I can't do that... I feel like a real idiot. Here's my code (with a hard-coded start time):
``wsdl_url = "https://webservices.chargepoint.com/cp_api_5.1.wsdl" client = Client(wsdl_url, wsse=UsernameToken(cpusername, cppassword))
def FleetUsageAPIcall(client): eastern_tz = pytz.timezone('America/New_York') now = datetime.now(ZoneInfo('America/New_York')) fleetusagedf = pd.DataFrame() tStart = datetime(2024, 5, 15, 00, 00, 00, tzinfo=eastern_tz) while tStart < now: tEnd = tStart + timedelta(days=10) searchQuery = {'fromTimeStamp': tStart, 'toTimeStamp': tEnd} fleetUsageData = client.service.getFleetUsageData(searchQuery) fleetusagedf = pd.concat([fleetusagedf, pd.DataFrame(helpers.serialize_object(fleetUsageData.fleetUsageData))]) tStart = tStart + timedelta(days = 10) if tStart > now: break return fleetusagedf
fleetusagedf = FleetUsageAPIcall(client)``
It's inside your SOAP api definition:
type="xsd:time"
with type="xsd:string"
Client
constructor with your modified version of cp_api_5.1.wsdl instead of the original upstream one
Zeep uses isodate to parse
xsd:time
:https://github.com/mvantellingen/python-zeep/blob/377d9313b1b4807a31a5ee42227f1dc7e7e0471e/src/zeep/xsd/types/builtins.py#L197-L198
isodate
does not like24:00:00
and throwsValueError: hour must be in 0..23
, but24:00:00
should be a valid value ofxsd:time
: http://www.datypic.com/sc/xsd/t-xsd_time.htmlWe are using zeep 4.2.1 and isodate 0.6.1.
Our (stupid) workaround was to replace
xsd:time
withxsd:string
.