using openurl to log into Yahoo services

joe_public34 joe_public34 at yahoo.com
Tue Nov 15 17:08:06 CET 2005


Hello all,

I'm trying to write a script to log into Yahoo! (mail, groups, etc),
but when I pass the full URL with all form elements via Python, I get
a resutling 400 - Bad Request page.  When I just plop the full URL
into a browser, it works perfectly. Is there something I need to
specify in python to submit the correct info (headers, user agent,
etc) to get the response I want? Here is the code I have that returns
the Bad Request:

import urllib, win32gui, win32clipboard, win32con, os, getpass, re
yid = raw_input("Yahoo! ID: ")
pw = getpass.getpass(prompt = 'Yahoo password: ')
url =
"https://login.yahoo.com/config/login?.tries=1&.src=ygrp&.intl=us&.v=0&.challenge=U4VY1YGqdPf8z3SaVccJdhV63YCw&.chkP=Y&.done=http://groups.yahoo.com&login="+yid+"&passwd="+pw+"&.persistent=y&.save=Sign
In"
temp = urllib.urlopen(url)
grp_list_source = temp.read()

Any thoughts or suggestions?  Thanks.







More information about the Python-list mailing list