🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #28496

[newbie][soap via suds] Jak użyć doSearch z api allegro używając python-allegro-webapi / allegro_webapi

#28496
From: horhe
Date: Thu, 06 Mar 2014 14:55
55 lines
3316 bytes
Cześć,
próbuję napisać prosty i krótki program, który wyświetli mi listę 
aukcji. Użyłem do tego klasy 
https://github.com/mattrick/python-allegro-webapi. O ile udaje się mi 
użyć metod z niezagnieżdzonymi parametrami to mam problem nad składnią 
dla metody doSearch 
(http://allegro.pl/webapi/documentation.php/show/id,116#method-input,camel).
Mam tak:
allegro=AllegroWebAPI('sss','login','haslo')
a nastepnie próbuję wyszukać, przykładowa, błędna próba to:

 >>> print 
allegro.doSearch(allegro.session_id,searchquery='searchString=aaa')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "allegro_webapi.py", line 55, in _service
     return component(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/suds/client.py", line 542, 
in __call__
     return client.invoke(args, kwargs)
   File "/usr/lib64/python2.7/site-packages/suds/client.py", line 602, 
in invoke
     result = self.send(soapenv)
   File "/usr/lib64/python2.7/site-packages/suds/client.py", line 649, 
in send
     result = self.failed(binding, e)
   File "/usr/lib64/python2.7/site-packages/suds/client.py", line 702, 
in failed
     r, p = binding.get_fault(reply)
   File "/usr/lib64/python2.7/site-packages/suds/bindings/binding.py", 
line 265, in get_fault
     raise WebFault(p, faultroot)
suds.WebFault: Server raised fault: 'Element 
'{https://webapi.allegro.pl/service.php}searchQuery': Missing child 
element(s). Expected is one of ( 
{https://webapi.allegro.pl/service.php}searchString, 
{https://webapi.allegro.pl/service.php}searchOptions, 
{https://webapi.allegro.pl/service.php}searchOrder, 
{https://webapi.allegro.pl/service.php}searchOrderType, 
{https://webapi.allegro.pl/service.php}searchCountry, 
{https://webapi.allegro.pl/service.php}searchCategory, 
{https://webapi.allegro.pl/service.php}searchOffset, 
{https://webapi.allegro.pl/service.php}searchCity, 
{https://webapi.allegro.pl/service.php}searchState, 
{https://webapi.allegro.pl/service.php}searchPriceFrom ).
'


Moje pytanie jest takie, jaka jest prawidłowa składnia aby móc zbudować 
i przekazać search-query (wraz z dodatkowymi parametrami) aby otrzymać 
wynik wyszukania?
Sama metoda jest opisana tak (print allegro.client)
[...]
doSearch(xs:string sessionHandle, SearchOptType searchQuery, )
[...]
Technical Details
Message-ID: <lfa28m$rjf$1@portraits.wsisiz.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!wsisiz.edu.pl!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!wsisiz.edu.pl!.POSTED!not-for-mail
From: horhe <niedzialajacy@kolekcja.mejor.pl>
Newsgroups: pl.comp.lang.python
Subject: [newbie][soap via suds] Jak użyć doSearch z
 api allegro używając python-allegro-webapi /
 allegro_webapi
Date: Thu, 06 Mar 2014 15:55:18 +0100
Organization: http://www.wit.edu.pl
Lines: 56
Message-ID: <lfa28m$rjf$1@portraits.wsisiz.edu.pl>
NNTP-Posting-Host: 83-144-115-210.static.chello.pl
Mime-Version: 1.0
X-Trace: portraits.wsisiz.edu.pl 1394117718 28271 83.144.115.210 (6 Mar 2014 14:55:18 GMT)
X-Complaints-To: abuse@wsisiz.edu.pl
NNTP-Posting-Date: Thu, 6 Mar 2014 14:55:18 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit