Urllib2 can't open the url http:// portal:8080. I assume that you can't visit that url from the browser either On 07/12/2014 3:46 pm, "Hossein Rashnoo" <[email protected]> wrote:
> I need this connection for adding list items and save my users data on > sharepoint database. I ran it in command line and when i write something > like """ print site.lists[0] """ this error appear : > > > File "<console>", line 1, in <module> > File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", > line 84, in __getitem__ > return self.all_lists[key] > File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", > line 36, in all_lists > result = self.opener.post_soap(LIST_WEBSERVICE, xml) > File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31, in > post_soap > response = self.opener.open(request) > File "/usr/lib64/python2.6/urllib2.py", line 391, in open > response = self._open(req, data) > File "/usr/lib64/python2.6/urllib2.py", line 409, in _open > '_open', req) > File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain > result = func(*args) > File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open > return self.do_open(httplib.HTTPConnection, req) > File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open > raise URLError(err) > URLError: <urlopen error [Errno -2] Name or service not known> > > > On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte > wrote: >> >> Ok, but I am not sure what this has to do with Django ? Maybe you should >> ask on a SharePoint mailing list ? And did you try running the code in a >> script on the command line ? >> >> François >> >> > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo <[email protected]> wrote: >> > >> > I need to connect my project to sharepoint. So i installed "sharepoint >> 0.4.1" package and then use this code in my view : >> > >> > from sharepoint import SharePointSite, basic_auth_opener >> > >> > def userloginres(request): >> > server_url = "http://portal:8080/" >> > site_url = server_url + "rashno/" >> > opener = basic_auth_opener(server_url, "my username", "my >> password") >> > site = SharePointSite(site_url, opener) >> > >> > htt=r"<h2>Sharepoint lists</h2><ul>" >> > for sp_list in site.lists: >> > htt = htt + r"<li> %s ..... %s </li>" % (sp_list.id >> ,sp_list.meta['Title']) >> > htt = htt + r"</ul>" >> > >> > t = get_template('userlogin/userloginres.html') >> > html= t.render(Context({"htt":htt})) >> > return HttpResponse(html) >> > >> > But now when i open that url this error appear: >> > >> > URLError at /test/login/ >> > >> > <urlopen error [Errno -2] Name or service not known> >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "Django users" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/django-users. >> > To view this discussion on the web visit https://groups.google.com/d/ >> msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7% >> 40googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. >> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHqTbj%3D5nfwvwi9AzXU62fOh%2B4P05GH6L19XULrezs_reVT4gg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

