Beary21 0 Newbie Poster

I'm trying to login to Valve's Steam website, but without any luck my 2 different scripts aren't working. Help please!?

Any script I find on the web appears to be outdated.

import urllib, urllib2, cookielib, webbrowser

data = urllib.urlencode({
 'action': 'doLogin',
 'goto': '',
 'steamAccountName': "****",
 'steamPassword': "****",
 })


# Login to Steam
jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
opener.open("https://steamcommunity.com", data).close()
urllib2.install_opener(opener)


# Check if logged in
opener.open('http://steamcommunity.com')
data = opener.read()
print data
webbrowser.open(opener.geturl())
opener.close()

----

import mechanize, cookielib, webbrowser

jar = cookielib.CookieJar()

browser = mechanize.Browser()
browser.set_handle_robots(False)
cookies = mechanize.CookieJar()
browser.set_cookiejar(jar)
browser.addheaders = [
  ('User-Agent', 'Opera/9.80 (Windows NT 6.1; U; IBM EVV/3.0/EAK01AG9/LE; en) Presto/2.9.168 Version/11.52'),
  ('Accept', 'application/xhtml+voice+xml;version=1.2, application/x-xhtml+voice+xml;version=1.2, text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'),
  ('Accept-Language', 'nl-BE,nl;q=0.9,en;q=0.8'),
  ('Accept-Encoding', 'gzip, deflate'),
  ('Referer', 'http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CBwQFjAA&url=http%3A%2F%2Fmyproxylists.com%2Fmy-http-headers&ei=M_vQTr-TMIPtOcbTyJAP&usg=AFQjCNEcMeeQV__rUk1yIOwOiRM4pWf2Jw&sig2=wIgepwmyqKRRR-qAzyD0cQ'),
  ('Connection', 'Keep-Alive'),
]

browser.open("https://steamcommunity.com")



browser.select_form(name="logon")
browser["username"] = "*****"
browser["password"] = "*****"

response = browser.submit()

result = response.read()

print result = response.read()
webbrowser.open(response.geturl())
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.