well, you first get to the authenticating page, that is where you put your username &amp; pass ! &amp; then you post them to be authenticated by server which then sends you a session id, which is a cookie.<br><br>now to make the server think you&#39;re loged in to the site you have to send him back the cookie.<br>
<br>now to send him the cookie you need the cookielib <br><br>so lets do it right now : <br><br><br>import urllib, urllib2, cookielib<br>user_agent = &#39;Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)&#39; url=&#39;http(s)://www.website_to_treat_nicely_and_not_abuse_using_python_scripts.com&#39;<br>
cj=cookielib.LWPCookieJar()<br>values={&#39;username&#39;:&#39;python_user&#39;, &#39;passwd&#39;:&#39;elephant&#39;}<br><br># let me explain here what values stand for :<br>#&nbsp; values will represent every one element of a form that is in the authentication page.<br>
#&nbsp; yes you got it what is between the &lt;form&gt; and &lt;/form&gt; &amp; there might be more <br># so you ll have to add them.<br>#<br><br>headers={&#39;User-Agent&#39; : user_agent}<br>opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))<br>
urllib2.install_opener(opener)<br><br># install_opener ? ???? what the hell is this ? ??? <br># well, now every request will take with it the cookie you got from server <br># in other words you will be logged-in to this website from now on<br>
#<br>&nbsp;<br>data=urllib.urlencode(values)<br><br># this is where actin starts (login page here)<br><br>req=urllib2.Request(url, data, headers)<br>response=urllib2.urlopen(req)<br><br><br>url2=&#39;http(s)://www.website_to_treat_nicely_and_not_abuse_using_python_scripts.com/second_page&#39;<br>
response2=urllib2.urlopen(url2)<br>response2.read()&nbsp;&nbsp; #you can get the page because urlopen manages the session/cookie for you for free.<br><br>url3=&#39;http(s)://www.website_to_treat_nicely_and_not_abuse_using_python_scripts.com/second_page&#39;<br>

response3=urllib2.urlopen(url3)<br>
response3.read() <br><br><br>well, hope this helps<br>