title: Problems login in to a website in python
body: <p>I've been trying to connect python with http/https sites and I came across urllib and urllib2.
  After some research I could create a website login but it seems that I'm doing something wrong, I tried with different webpages but I can't do it with any.
  There is the code I've been working on:</p>
  
  <pre><code>import urllib, urllib2, cookielib
  
  #guardar cookies
  cookies = cookielib.CookieJar()
  
  #crear opener
  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
  
  user = raw_input("Introdueix el teu nom d'usuari: ")
  contra = raw_input("Introdueix la teva pass: ")
  
  login_data = urllib.urlencode({'login' : user,'password' : contra})
  sessio = opener.open('http://streamcloud.eu/login.html', login_data)
  
  #en teoria ja esta logejat a partir d'aqui
  
  print "La URL accedida es:",sessio.geturl()
  
  #tanquem la web
  sessio.close()
  </code></pre>
  
  <p>The form of the website is this one:</p>
  
  <pre><code>&lt;form method="POST" action="http://streamcloud.eu/" class="proform" name="FL"&gt;
  &lt;input type="hidden" name="op" value="login"&gt;
  &lt;input type="hidden" name="redirect" value="http://streamcloud.eu/?op=upload"&gt;
  
  &lt;p&gt;
      &lt;label&gt;Username:&lt;/label&gt;
      &lt;input type="text" style="font-style: normal;" name="login" value="deuseux" class="text_field" /&gt;
  &lt;/p&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;p&gt;
      &lt;label&gt;Password:&lt;/label&gt;
      &lt;input type="password" style="font-style: normal;" name="password" class="text_field" /&gt;
  &lt;/p&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;div&gt;
      &lt;input type="submit" class="button blue medium" value="Submit"&gt;
  &lt;/div&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>The login form is in this webpage: <a href="http://streamcloud.eu/login.html" rel="nofollow">http://streamcloud.eu/login.html</a> while the action of the form is in <a href="http://streamcloud.eu" rel="nofollow">http://streamcloud.eu</a>, maybe there's where I'm doing something wrong?
  If I put a print sessio.read() I can clearly see that I'm not logged in</p>
  
  <p>Does anyone see something wrong with the code?
  Thanks!</p>
  
  <p>ps: sorry for my bad english</p>