Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeep fails to parse 24:00:00 as xsd:time (ValueError: hour must be in 0..23) #1401

Open
Trolldemorted opened this issue Dec 19, 2023 · 2 comments

Comments

@Trolldemorted
Copy link

Zeep uses isodate to parse xsd:time:

def pythonvalue(self, value):
return isodate.parse_time(value)

isodate does not like 24:00:00 and throws ValueError: hour must be in 0..23, but 24:00:00 should be a valid value of xsd:time: http://www.datypic.com/sc/xsd/t-xsd_time.html

We are using zeep 4.2.1 and isodate 0.6.1.

Our (stupid) workaround was to replace xsd:time with xsd:string.

@alixepstein
Copy link

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)``

@Trolldemorted
Copy link
Author

It's inside your SOAP api definition:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants