Skip to content

Timezone is lost for xsd:date value #769

@wbkoetsier

Description

@wbkoetsier

Zeep 2.5.0
Python 3.6.0
WSDL: http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl

Running

client = Client(wsdl=self.BASE_URL)
response = client.service.checkVat(countryCode='NL', vatNumber='TESTVATNUMBER')

gives me a value of datetime.date(2018, 6, 6) for requestDate. I was a bit suspicious because the time zone is missing here, so I checked the 'raw' XML output:

client = Client(wsdl=self.BASE_URL)
with client.options(raw_response=True):
    response = client.service.checkVat(countryCode='NL', vatNumber='TESTVATNUMBER')

which gives me <requestDate>2018-06-06+02:00</requestDate> (I was expecting a time here too, but the wsdl clearly states that requestDate is in xsd:date format, so no time), so the time zone is actually provided by the service.

What could be the problem here? Any help would be appreciated.

Activity

mvantellingen

mvantellingen commented on Jun 16, 2018

@mvantellingen
Owner

The date is parsed using the isodate module, see https://github.com/mvantellingen/python-zeep/blob/master/src/zeep/xsd/types/builtins.py#L177

Python doesn't support timezones for times. So to support this properly we should always return a datetime object instead of a date object.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mvantellingen@wbkoetsier

        Issue actions

          Timezone is lost for xsd:date value · Issue #769 · mvantellingen/python-zeep