usr bin python coding utf-8 import sys from suds import WebFault from

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from suds import WebFault
from suds import serviceproxy
from suds.client import *
import urllib2
url_sharepoint = 'http://portal/TechZone/TechClosedZone/'
wsdl = '_vti_bin/SiteData.asmx?WSDL'
url = '/'.join([url_sharepoint,wsdl])
url_NTLM_authproxy = "127.0.0.1:5865"
proxy_handler = urllib2.ProxyHandler({'http': url_NTLM_authproxy })
opener = urllib2.build_opener(proxy_handler)
client = Client(url, opener=opener)
result = client.service.GetListItems('{F9CE0329-5EB6-4505-960B-2F0B75352863}', '', '', 600)
foo = result.encode('utf8')
filename = "fromportal.txt"
FILE = open(filename,"w")
FILE.writelines(foo)
FILE.close
print "wrote file: " + filename
#attr = elem.hasProp('ows_LinkTitleNoMenu')
#reflist = xmldoc.getElementsByTagName('ows__x0424__x0438__x0437__x0438__x04')
нормально работает на python 2.5
на 2.4.4:
[thresh@warez portalstuff]$ ./getdatafromportal.py
Traceback (most recent call last):
File "./getdatafromportal.py", line 21, in ?
client = Client(url, opener=opener)
File "build/bdist.linux-i686/egg/suds/client.py", line 101, in __init__
File "build/bdist.linux-i686/egg/suds/options.py", line 88, in set
File "build/bdist.linux-i686/egg/suds/options.py", line 75, in __setattr__
File "build/bdist.linux-i686/egg/suds/options.py", line 107, in validate
File "build/bdist.linux-i686/egg/suds/options.py", line 114, in vkeys
AttributeError: "opener" not in: ['username', 'soapheaders', 'headers', 'faults', 'proxy', 'password', 'port', 'transport', 'location']