I'm using python and beautifulsoup (new to both!), and I want to login to a suppliers website.
So their form looks like (simplified):
<form name=loginform action=/index.html method="post"开发者_JAVA技巧>
<input name=user>
<input name=pass">
</form>
Is there a way to keep track for cookies?
Do some more reading.
Read about urllib2
That's what you use to do a POST to login. If you know the <input>
names, you don't need Beautiful Soup. http://docs.python.org/library/urllib2.html
Beautiful Soup is what you use to parse a page of results. After you login. After you post the real request.
Use mechanize -- that's just the best (3rd party) Python library for interacting with web forms, keeping track of cookies &c.
精彩评论