IIRC, you will need to use urllib2 and provide a "urlopener" that handles the 403 and responds with the credentials. The more recent python (e.g.2.6) documentation is pretty clear about it. Again, from memory.
Bill On Tue, Oct 12, 2010 at 1:52 PM, harryos <[email protected]> wrote: > mm..I tried that..it gives 403 error.. > I don't think putting login info in request will help..that will work > only for 401 I believe.. > not sure how to handle 403 from server..Any comments guys? > harry > > > On Oct 12, 6:19 pm, jimgardener <[email protected]> wrote: >> hi >> I was trying to get data from different web pages using urlopen and >> read. >> >> from urllib import urlopen >> def get_page_data(url): >> f=urlopen(url) >> return f.read() >> >> when I gave this url ,it produces a 'forbidden' response >> >> print get_page_data('http://groups.google.com/group/django-users/ >> topics') >> >> ==> >> <html> >> ... >> <body ... >> <H1>Forbidden</H1> >> Your client does not have permission to get URL <code>/group/django- >> users/topics</code> from this server. >> ... >> >> I understand that it needs my login info..In a client program ,how do >> I add this?My django app maintains a list of urls entered by a user >> and at a user given time opens and reads from each of the urls.In the >> db I am storing the url string ,a user object and a datetime value >> entered by the user .Suppose one of those urls needs login info as in >> the above case,how can I store those?The same user may have different >> login username,passwords for different urls.I don't think storing user >> password in db is a good idea.. >> Is there a way to deal with this? >> Any suggestions? >> regards >> jim > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

