It doesn't put quotes around the date on my machine, what version of SUDS are
you using? Here's the packet dump I made with Wireshark:
POST /api/0_5/ClassService.asmx HTTP/1.1
Accept-Encoding: identity
Content-Length: 658
Soapaction: "http://clients.mindbodyonline.com/api/0_5/GetClassSchedules"
Host:
User-Agent: Python-urllib/2.7
Connection: close
Content-Type: text/xml
<SOAP-ENV:Envelope
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetClassSchedules>
<ns1:Request>
<ns1:XMLDetail>Full</ns1:XMLDetail>
<ns1:PageSize xsi:nil="true"/>
<ns1:CurrentPageIndex xsi:nil="true"/>
<ns1:StartDate>2011-11-19</ns1:StartDate>
<ns1:EndDate xsi:nil="true"/>
</ns1:Request>
</ns1:GetClassSchedules>
</ns0:Body>
</SOAP-ENV:Envelope>
Regards,
András Veres-Szentkirályi
2011. november 22. kedd 21:14:19 dátummal brian downing ezt írta:
Hi András,
Converting the date to a string doesn't work. It puts quotes around the
date and the server ignores that part.
I'm thinking about writing a plugin that strips out the quotes.
Thank you for your help!!!!
Brian
On 11/21/2011 9:14 PM, Veres-Szentkiralyi Andras wrote:
> It works for me, if I set the XML detail parameter (it said so in the
> exception). Have you tried it this way?
>
> client =
>
suds.client.Client('http://clients.mindbodyonline.com/api/0_5/ClassSe...
> e.asmx?wsdl') req = client.factory.create('GetClassSchedulesRequest')
> xdl = client.factory.create('XMLDetailLevel')
> req.StartDate = str(datetime.date(2011, 11, 19))
> req.XMLDetail = xdl.Full
> result = client.service.GetClassSchedules(req)
>
> print result
> (GetClassSchedulesResult){
>
> Status = "InvalidCredentials"
> Message = "SourceCredentials must be provided."
> XMLDetail = "Full"
> ResultCount = 0
> CurrentPageIndex = 0
> TotalPageCount = 0
>
> }
>
> Regards,
> András Veres-Szentkirályi
>
> 2011. november 22. kedd 02:05:52 dátummal brian downing ezt írta:
>> The str method doesn't work. It wraps quotes in the request. Here is the
>> code:
>>
>> ------------------------------------------
>>
>> import datetime
>>
>> client =
>>
suds.client.Client('http://clients.mindbodyonline.com/api/0_5/ClassServi
>> ce. asmx?wsdl')
>>
>>
>>
>> req = client.factory.create('GetClassSchedulesRequest')
>>
>> req.StartDate = datetime.date(2011, 11, 19)
>>
>>
>> result = client.service.GetClassSchedules(req)
>>
>> ------------------------------------------
>>
>>
>> Brian
>>
>> On 11/19/2011 4:35 PM, brian downing wrote:
>>> I'm trying to create a date with
like:<StartDate>2011-02-15</StartDate>
>>>
>>>
>>> I did something like:
>>>
>>> req = client.factory.create('GetClassSchedulesRequest')
>>>
>>> req.StartDate = datetime.date(2011, 11, 19)
>>>
>>> result = client.service.GetClassSchedules(req)
>>>
>>>
>>> And I get the error:
>>>
>>> ValueError:<type 'datetime.date'>
>>>
>>>
>>> If I stop the code before the client.service call and do<print req>
>>> the format is correct.
>>>
>>>
>>> Brian