Take the 2-minute tour ×

I'm working on a small project and I've run into a small problem. The script I have needs to fetch a website and find a specific value in the source HTML file. The value is like this:


  <input type='hidden' name='hash' value='e46c945fe32a3' /> 

Now I'm been trying to use the ElementTree library to parse the HTML document to find the value but I haven't been very successful. I'm really new to Python so I don't really know what to do next.

I've been using httplib and urllib/urllib2 to connect to the website and POST my login details and things like that but I really don't know how to get that value from the page. I thought I could send a request for the input named 'hash' but I have no idea how to do that.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You might consider looking at the BeautifulSoup library - it's designed to be quick and easy to use.

share|improve this answer
Thanks, that's probably exactly what I need but I'm not sure how to actually put it to use. Could you give me some hints on how to actually USE BeautifulSoup to search the HTML document? –  Bjarki Jonasson Jul 5 '10 at 0:34
Take a look at the Quick Start portion of the documentation: crummy.com/software/BeautifulSoup/documentation.html#Quick Start –  Amber Jul 5 '10 at 0:46

Your Answer


