🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#28497
From: horhe
Date: Mon, 10 Mar 2014 13:40
68 lines
3750 bytes
W dniu 06.03.2014 15:55, horhe pisze:
> 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, )
> [...]
>


Mam...:

szukaj= {
         'searchString':'foo',
         'searchOrder':'4',
         'searchOrderType':'1'
}
wynik=allegro.doSearch(sessionHandle=allegro.session_id,searchQuery=szukaj)
Technical Details
Message-ID: <lfkfcu$o4$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
References: <lfa28m$rjf$1@portraits.wsisiz.edu.pl>

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: Re: [newbie][soap via suds] Jak użyć doSearch
 z api allegro używając python-allegro-webapi /
 allegro_webapi
Date: Mon, 10 Mar 2014 14:40:46 +0100
Organization: http://www.wit.edu.pl
Lines: 71
Message-ID: <lfkfcu$o4$1@portraits.wsisiz.edu.pl>
References: <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 1394458846 772 83.144.115.210 (10 Mar 2014 13:40:46 GMT)
X-Complaints-To: abuse@wsisiz.edu.pl
NNTP-Posting-Date: Mon, 10 Mar 2014 13:40:46 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
In-Reply-To: <lfa28m$rjf$1@portraits.wsisiz.edu.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit