Question

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:

id='elementID'> 

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

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top