[Tutor] python + sharepoint
Brad Hudson
brad.hudson at gmail.com
Fri Mar 2 18:03:03 CET 2012
Can someone assist in a very basic task of retrieving a '.txt' file
from a sharepoint document library using Python 2.4 standard
libraries? I'm certain, I need to build up some form of authentication
to pass, but do not know where to begin. Also, I do not want to
attempt to customize or install additional packages to the server for
this (Solaris).
Note: url is changed below for obvious reasons, but the traceback is untouched.
# ./get_file.py
Traceback (most recent call last):
File "./get_file.py", line 7, in ?
result = urllib2.urlopen(url).readlines()
File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.4/urllib2.py", line 364, in open
response = meth(req, response)
File "/usr/lib/python2.4/urllib2.py", line 471, in http_response
response = self.parent.error(
File "/usr/lib/python2.4/urllib2.py", line 402, in error
return self._call_chain(*args)
File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
result = func(*args)
File "/usr/lib/python2.4/urllib2.py", line 480, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request
[root at ilhsf001h001]# cat get_file.py
#!/usr/bin/env python
import urllib2
url = 'http://myserver.com/myfile.txt'
result = urllib2.urlopen(url).readlines()
print result
#
More information about the Tutor
mailing list