Advertisement
MrPoxipol

Python WWW Login

Feb 7th, 2014
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import cookielib
  2. import urllib
  3. import urllib2
  4.  
  5. url = 'http://cpp0x.pl'
  6. values = {'UserPanel_NazwaKonta' : 'twojekonto',
  7.           'UserPanel_Haslo' : 'twojehaslo' }
  8.  
  9. data = urllib.urlencode(values)
  10. cookies = cookielib.CookieJar()
  11.  
  12. opener = urllib2.build_opener(
  13.     urllib2.HTTPRedirectHandler(),
  14.     urllib2.HTTPHandler(debuglevel=0),
  15.     urllib2.HTTPSHandler(debuglevel=0),
  16.     urllib2.HTTPCookieProcessor(cookies))
  17.  
  18. response = opener.open(url, data)
  19. the_page = response.read()
  20. http_headers = response.info()
  21.  
  22. # Tutaj zapisuje strone, ktora dostalem
  23. f_ht = open("www.html", 'w')
  24. f_ht.write(the_page)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement