mechanize login problem with website

elca highcar at gmail.com
Thu Nov 19 15:50:09 EST 2009




elca wrote:
> 
> Hello
> 
> I'm making auto-login script by use mechanize python.
> 
> Before I was used mechanize with no problem, but http://www.gmarket.co.kr
> in this site I couldn't make it .
> 
> whenever i try to login always login page was returned even with correct
> gmarket id , pass, i can't login and I saw some suspicious message
> 
> "<script language=javascript>top.location.reload();</script>"
> 
> I think this related with my problem, but don't know exactly how to handle
> .
> 
> i was upload my script in here
> 
> # -*- coding: cp949 -*-
> from lxml.html import parse, fromstring
> import sys,os
> import mechanize, urllib
> import cookielib
> import re
> from BeautifulSoup import BeautifulSoup,BeautifulStoneSoup,Tag
> 
> try:
> 
>     params = urllib.urlencode({'command':'login',
>                                'url':'http%3A%2F%2Fwww.gmarket.co.kr%2F',
>                                'member_type':'mem',
>                                'member_yn':'Y',
>                                'login_id':'tgi177',
>                                'image1.x':'31',
>                                'image1.y':'26',
>                                'passwd':'tk1047',
>                                'buyer_nm':'',
>                                'buyer_tel_no1':'',
>                                'buyer_tel_no2':'',
>                                'buyer_tel_no3':''
>         
>                                })
>     rq = mechanize.Request("http://www.gmarket.co.kr/challenge/login.asp")
>     rs = mechanize.urlopen(rq)
>     data = rs.read()    
> 
>     
>     logged_in = r'input_login_check_value'  in data                                    
>     if logged_in:
>         print ' login success !'  
>         rq = mechanize.Request("http://www.gmarket.co.kr") 
>         rs = mechanize.urlopen(rq)
>         data = rs.read()   
>         print data  
>                          
>     else:
>         print 'login failed!'
>         pass
>         quit()      
> except:
>     pass
> 
> 
> if anyone can help me much appreciate thanks in advance
> 
> 
i was updated my script source
-- 
View this message in context: http://old.nabble.com/mechanize-login-problem-with-website-tp26420202p26421474.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list