Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'skip:[ 20': 0.03; 'socket': 0.05; 'parameter': 0.07; 'raised': 0.07; 'soap': 0.07; 'python': 0.09; '__init__': 0.09; 'behave': 0.09; 'dict': 0.09; 'happens.': 0.09; 'hashlib': 0.09; 'http,': 0.09; 'tcp/ip': 0.09; 'way:': 0.09; 'def': 0.10; 'do,': 0.15; 'library': 0.15; "skip:' 30": 0.15; '24,': 0.16; 'also:': 0.16; 'dictionary,': 0.16; 'do).': 0.16; 'fluent': 0.16; 'hard-coded': 0.16; 'itself),': 0.16; 'oddly': 0.16; 'on"': 0.16; 'scope,': 0.16; 'sha1': 0.16; 'skip:" 100': 0.16; 'skip:{ 30': 0.16; 'subject: \n ': 0.16; 'subject:array': 0.16; 'subject:object': 0.16; 'subject:type': 0.16; 'try/except': 0.16; 'tuple,': 0.16; 'later': 0.16; 'wrote:': 0.17; 'script.': 0.17; 'requests': 0.18; '(or': 0.18; 'load': 0.19; 'translate': 0.20; 'packaging': 0.20; 'putting': 0.20; 'import': 0.21; 'assuming': 0.22; 'sends': 0.22; 'stick': 0.22; 'terminate': 0.22; "i'd": 0.22; "i've": 0.23; 'seems': 0.23; 'script': 0.24; 'testing': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'charset:iso-8859-15': 0.26; 'am,': 0.27; 'skip:" 50': 0.27; 'actual': 0.28; 'chris': 0.28; 'initial': 0.28; 'helpful.': 0.29; 'invoke': 0.29; 'prints': 0.29; 'skip:_ 10': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'maybe': 0.29; 'usually': 0.30; 'ends': 0.30; 'error': 0.30; 'on,': 0.30; 'stuff': 0.30; 'file': 0.32; "skip:' 20": 0.32; 'switch': 0.32; 'page.': 0.33; 'messages,': 0.33; 'zero': 0.33; 'to:addr:python- list': 0.33; 'code:': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'server': 0.35; 'list': 0.35; 'from:addr:googlemail.com': 0.35; 'open': 0.35; "won't": 0.35; 'something': 0.35; 'add': 0.36; 'but': 0.36; "didn't": 0.36; 'client': 0.36; "i'll": 0.36; 'should': 0.36; 'enough': 0.36; 'unable': 0.36; 'xml': 0.37; 'quite': 0.37; 'rather': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'object': 0.38; 'some': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'google': 0.39; 'your': 0.60; 'easy': 0.60; 'save': 0.61; 'monitoring': 0.61; 'telling': 0.61; 'traffic': 0.61; "you'll": 0.62; 'back': 0.62; 'between': 0.63; 'different': 0.63; 'information,': 0.63; 'here': 0.65; '20,': 0.65; 'carried': 0.65; 'obvious': 0.71; 'yourself': 0.77; 'hand': 0.82; '2013': 0.84; 'around,': 0.84; 'fortunately': 0.84; 'suspicion': 0.84; 'megabytes': 0.91; 'subject:skip:S 20': 0.91; 'url:open': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ai+IuD4aXfOeu7C2498AiUFq5hTjL+iY603JocvFib8=; b=GfZtekJBdSjZhRmkvKM03z321JXiLUfqNqsILD/QiTf46ElFOQueiv17dMPRE29jsI oJ95StrGaWU3T6F/frJIYimyT6iYYm6usB4CBXGj5WItNFqOmjnKVkD3P1F0Bjv5NgDD z4XAkDhm5TXyYXV3vWPjGuc2Glw470/fXgJ+HFmGrd7WG0lHJbO3TkieSIBMipxZQKvQ gcNClBBr/Vg4JGvBuk6XJfahonWQYqqb2c563A5JqsblqX68jS+r8i8yeJ1iU/vimhrn x2c+btgQCrkqG626tAkPV8HFeAx9N9KGnmDDXWq9rURc16Ni/Fud6YHxhiJqXlZ9/AQ/ NW+w== X-Received: by 10.15.23.193 with SMTP id h41mr17159355eeu.17.1364067523219; Sat, 23 Mar 2013 12:38:43 -0700 (PDT) Date: Sat, 23 Mar 2013 20:38:41 +0100 From: Tamer Higazi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130309 Thunderbird/17.0.4 MIME-Version: 1.0 To: python-list@python.org Subject: Re: SOAPpy.Types.faultType: Cannot use object of type stdClass as array References: <514A0898.4000807@googlemail.com> <514DAF1D.50801@googlemail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 132 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364067531 news.xs4all.nl 6865 [2001:888:2000:d::a6]:36010 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41751 Chris! I did what you said before in several ways. The last way was putting the user and password directly into the dict as parameter ALWAYS ends up telling me, that I cannot use object of standard type class as ARRAY.... I did it this time with suds. So packaging issue is now out of scope, and always the same headache. now tell me what this error might tell me: suds.WebFault: Server raised fault: 'Cannot use object of type stdClass as array' File "/storage/PyProjects/toolsAPP/python/KASUpdate2.py", line 23, in KasObj = KASSystem() File "/storage/PyProjects/toolsAPP/python/KASUpdate2.py", line 20, in __init__ 'SessionUpdateLifeTime':'Y'}) File "/storage/PyENV/lin/toolsENV/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/client.py", line 542, in __call__ File "/storage/PyENV/lin/toolsENV/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/client.py", line 602, in invoke File "/storage/PyENV/lin/toolsENV/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/client.py", line 649, in send File "/storage/PyENV/lin/toolsENV/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/client.py", line 702, in failed File "/storage/PyENV/lin/toolsENV/lib/python2.7/site-packages/suds-0.4-py2.7.egg/suds/bindings/binding.py", line 265, in get_fault and when I open the python files they hand me out only the error messages, which was sent back from Server! here is the code: import hashlib from suds.client import Client from suds import WebFault class KASSystem: def __init__(self): WSDL_AUTH = 'https://kasapi.kasserver.com/soap/wsdl/KasAuth.wsdl' WSDL_API = 'https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl' m = hashlib.sha1() m.update('userpass') SoapClient = Client(WSDL_AUTH) SoapClient.service.KasAuth({ 'KasUser':'userlogin', 'KasAuthType':'sha1', 'KasPassword':m.hexdigest(), 'SessionLifeTime':1800, 'SessionUpdateLifeTime':'Y'}) KasObj = KASSystem() Tamer Am 23.03.2013 16:03, schrieb Chris Angelico: > On Sun, Mar 24, 2013 at 12:33 AM, Tamer Higazi wrote: >> Hi Chris! >> thanks.... But I am about of going nuts.... I did everything according >> their sample: >> >> http://kasapi.kasserver.com/dokumentation/?open=soap > > Since I'm not fluent in German, I'm relying on Google Translate to > read of that page. (I didn't find an obvious English version of the > page, but maybe I just didn't look in the right place.) > > One thing I've found about the PHP SOAP library is that it seems to > behave quite oddly in some circumstances - my suspicion is the WSDL > file (eg when it's unable to load it). Try monitoring the actual > traffic - SOAP is XML carried over HTTP, so you should be able to just > snoop the TCP/IP socket (easiest way might be to switch in your own > server). See if you can spot a difference between the request that PHP > sends and the one your Python script sends. Fortunately you're not > moving megabytes of data around, here - it should be easy enough to > eyeball the requests and see what's different about them :) > > A tip, by the way: > > userpass = ['login','password'] > m = hashlib.sha1() > m.update(userpass[1]) > > userpass[1] = m.hexdigest() > loginData = {'user':userpass[0],'pass':userpass[1]} > > 'KasUser':loginData['user'], > 'KasPassword':loginData['pass'], > > You keep packaging and repackaging the credentials. I'm assuming you > won't actually have them hard-coded like that (if you do, I would > recommend hard-coding the SHA1 hash, rather than the password itself), > so I'll stick with the userpass list (or tuple, which would work > exactly the same way). > > password = hashlib.sha1(userpass[1]).hexdigest() > ... > 'KasUser':userpass[0], > 'KasPassword':password, > > Or even inline that completely (which is what I'd probably do). > There's no need to stuff it into a dictionary, only to pull it out > again. > > Also: A try/except that just prints out the error message usually > isn't helpful. Save yourself the trouble, at least during initial > testing - just let the exception terminate your script. You'll get all > the same information, plus the full traceback, and it's cost you > exactly zero development time :) Later on, you can add try/except if > you need to do something other than terminate, but often that "later > on" never even happens. > > ChrisA >