[Tutor] python help
I have tried to find out the solution my self, and have failed to do so. So here is my problem: I want to submit text into an edit box on a web page. ie the equivalent of me typing text into the edit box and clicking the submit button. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] urllib2 and cookies
I want to read the html source off a site but the site requires cookies. What code must I use to handle my cookies, instead of me typing them out? NB I want to use urllib2 to open the site, not urllib. I am currently using python 2.5 This is what I have done so far, but I do not want to type out all the cookies. import urllib2 data = urllib2.Request(url = "http://www.example.com";, data = 'COOKIE:') htmlSource = urllib2.urlopen(data).read() Thanks in advance... __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] images
Hi I would like to know which is the best module to use, with regard to my needs: - I would like to read an image off a website e.g. http://www.examplecom/image/1/PNG/ - I would then like to read the pixels and do other things to the image I am currently using python 2.5 Thanks in advance . . . __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] lst file
Hi I am trying to read from a specific .lst file. When I read from it, it just prints out blank lines and I am sure that this file contains content. This is what I am using to read from the file: f = open("C:\\Users\\UserName\\Directory\\words.lst") for line in f: print line f.close() Do you guys know what is wrong? Thanks in advance. - Never miss a thing. Make Yahoo your homepage.___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] login
I am trying to get the cookies from the site when I login, though html.info(). The problem is that when I check the source ( html.read() ) it shows that it does not recognize me as logged in. Also, if I chech html.info(), the cookies that I am suppose to receive, if I logged in successfully, are not there. What am I doing wrong?import urllibimport urllib2opener = urllib2.build_opener()opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12'), ('Referer', 'http://www.site.org/index.php') ]values = urllib.urlencode({'user_name': 'MyUsername', 'user_pass': 'MyPass^^', 'login' : 'Login'})req = urllib2.Request('http://www.site.org/index.php', values)html = opener.open(req)print html.info()print html.read()html.close() Looking for last minute shopping deals? Find them fast with Yahoo! Search. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] login
Using the cookie jar is not going to solve my problem. I don't want to use the cookie jar. I just want to send the right request so that I will be sent back the right header, which will contain the information that I want. Apparently I am not sending the right request because the header that I am receieving does not have the "Set-Cookie"s that I want. i.e. I am being recognized as not logged in (non member etc).--- On Sat, 3/15/08, Kent Johnson <[EMAIL PROTECTED]> wrote: From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] login To: [EMAIL PROTECTED] Cc: Tutor@python.org Date: Saturday, March 15, 2008, 11:44 AM SwartMumba snake wrote: > I am trying to get the cookies from the site when I login, though > html.info(). The problem is that when I check the source ( html.read() ) > it shows that it does not recognize me as logged in. Also, if I chech > html.info(), the cookies that I am suppose to receive, if I logged in > successfully, are not there. What am I doing wrong? urllib2 does not support cookies by default, you have to configure it with a CookieJar: import cookielib, urllib2 cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) Then use this opener as below. I think you will have to look at the CookieJar to see the cookies. Kent > opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT > 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12'), > ('Referer', 'http://www.site.org/index.php') > ] > > values = urllib.urlencode({'user_name': 'MyUsername', 'user_pass': > 'MyPass^^', 'login' : 'Login'}) > req = urllib2.Request('http://www.site.org/index.php', values) > > html = opener.open(req) Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] mod python
Hello Python Mailing ListI am trying to set up mod python 3.3.1. I have python 2.5.1, apache 2.2 server, and my os is Vista. The problem is that after I install mod python, there is no mod_python.so in the apache modules directory. Thus the "LoadModule python_module modules/mod_python.so" call does not work. What should I do.Thanks. Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor