Hello people,
i´m receiving data from a webservice and trying pass data to python objects. Logging says that suds succeeds in receive the response from server. But when i try to loop the response python raises and unicode error. here is the part where is the problem . . . response = client.service.SearchHotel(SearchHotelRequest) hoteis = response.diffgram.SearchHotelResult[1] for hotel in hoteis: hotel Error in formatting: 'ascii' codec can't encode character u'\xca' in position 2: ordinal not in range(128)
Is there another way to extract data from response ?
Tobias
Hi.
On 28.11.2013. 2:22, Tobias Ramos Rocha wrote:
Hello people,
i´m receiving data from a webservice and trying pass data to python objects. Logging says that suds succeeds in receive the response from server. But when i try to loop the response python raises and unicode error. here is the part where is the problem . . . response = client.service.SearchHotel(SearchHotelRequest) hoteis = response.diffgram.SearchHotelResult[1] for hotel in hoteis: hotel Error in formatting: 'ascii' codec can't encode character u'\xca' in position 2: ordinal not in range(128)
Is there another way to extract data from response ?
If you send us the exact WSDL and the exact HTTP response to your query, someone can take a look.
Hope this helps.
Best regards, Jurko Gospodnetić
This seems to be more of a python issue with character encoding, rather than a suds issue with handling the web service. You can get the raw XML data of that was received and interpreted by suds by calling client.last_received() after making the service call. Although I bet that if you fixed the unicode errors with the format of the strings of data you're receiving, then you'll solve this bug.
I guess response.diffgram.SearchHotelResult[1] is an array of unicode strings? And python is by default trying to make it into an ascii encoded string in the for loop? Just guessing. But I don't think this is a suds problem.
On Wed, Nov 27, 2013 at 7:22 PM, Tobias Ramos Rocha tobias@acayaca.netwrote:
Hello people,
i´m receiving data from a webservice and trying pass data to python objects. Logging says that suds succeeds in receive the response from server. But when i try to loop the response python raises and unicode error. here is the part where is the problem . . . response = client.service.SearchHotel(SearchHotelRequest) hoteis = response.diffgram.SearchHotelResult[1] for hotel in hoteis: hotel Error in formatting: 'ascii' codec can't encode character u'\xca' in position 2: ordinal not in range(128)
Is there another way to extract data from response ?
Tobias
suds mailing list suds@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/suds
oh... oops.. this seems to have been answered in another thread entitled 'WSDL diffgrams'
On Fri, Nov 29, 2013 at 11:18 AM, Matthew Ashton matthew.ashton3@gmail.comwrote:
This seems to be more of a python issue with character encoding, rather than a suds issue with handling the web service. You can get the raw XML data of that was received and interpreted by suds by calling client.last_received() after making the service call. Although I bet that if you fixed the unicode errors with the format of the strings of data you're receiving, then you'll solve this bug.
I guess response.diffgram.SearchHotelResult[1] is an array of unicode strings? And python is by default trying to make it into an ascii encoded string in the for loop? Just guessing. But I don't think this is a suds problem.
On Wed, Nov 27, 2013 at 7:22 PM, Tobias Ramos Rocha tobias@acayaca.netwrote:
Hello people,
i´m receiving data from a webservice and trying pass data to python objects. Logging says that suds succeeds in receive the response from server. But when i try to loop the response python raises and unicode error. here is the part where is the problem . . . response = client.service.SearchHotel(SearchHotelRequest) hoteis = response.diffgram.SearchHotelResult[1] for hotel in hoteis: hotel Error in formatting: 'ascii' codec can't encode character u'\xca' in position 2: ordinal not in range(128)
Is there another way to extract data from response ?
Tobias
suds mailing list suds@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/suds