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
The format seems correct, because the string representation of a datetime.date object is the date in ISO format (YYYY-MM-DD). Without any knowledge of the schema of your service, I'd advise you to use req.StartDate = str(datetime.date(2011, 11, 19)). If that doesn't work for you, please share the WSDL/Schema with the mailing list.
Regards, András Veres-Szentkirályi
2011. november 19. szombat 22:35:07 dátummal brian downing ezt írta:
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
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/ClassService.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
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/ClassService.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/ClassService. 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
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/ClassService.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
- 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/ClassService. 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
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: clients.mindbodyonline.com User-Agent: Python-urllib/2.7 Connection: close Content-Type: text/xml
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://clients.mindbodyonline.com/api/0_5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/%22%3E SOAP-ENV:Header/ ns0:Body ns1:GetClassSchedules ns1:Request ns1:XMLDetailFull</ns1:XMLDetail> <ns1:PageSize xsi:nil="true"/> <ns1:CurrentPageIndex xsi:nil="true"/> ns1:StartDate2011-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/ClassServic 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
- 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