J
james27
hello..
im new to python.
i have some problem with mechanize.
before i was used mechanize with no problem.
but i couldn't success login with some site.
for several days i was looked for solution but failed.
my problem is , login is no probelm but can't retrieve html source code from
opened site.
actually only can read some small html code, such like below.
<html>
<script language=javascript>
location.replace("http://www.naver.com");
</script>
</html>
i want to retrive full html source code..but i can't . i was try with twill
and mechanize and urllib and so on.
i have no idea.. anyone can help me?
here is full source code.
and Thanks in advance!
# -*- coding: cp949 -*-
import sys,os
import mechanize, urllib
import cookielib
import re
import BeautifulSoup
params = urllib.urlencode({'url':'http://www.naver.com',
'svctype':'',
'viewtype':'',
'postDataKey':'',
'encpw':'3a793b174d976d8a614467eb0466898230f39ca68a8ce2e9c866f9c303e7c96a17c0e9bfd02b958d88712f5799abc5d26d5b6e2dfa090e10e236f2afafb723d42d2a2aba6cc3f268e214a169086af782c22d0c440c876a242a4411860dd938c4051acce987',
'encnm':'100003774',
'saveID':'0',
'enctp':'1',
'smart_level':'1',
'id':'lbu142vj',
'pw':'wbelryl',
'x':'24',
'y':'4'
})
rq = mechanize.Request("http://nid.naver.com/nidlogin.login", params)
rs = mechanize.urlopen(rq)
data = rs.read()
print data
rq = mechanize.Request("http://mail2.naver.com")
rs = mechanize.urlopen(rq)
data = rs.read()
print data
im new to python.
i have some problem with mechanize.
before i was used mechanize with no problem.
but i couldn't success login with some site.
for several days i was looked for solution but failed.
my problem is , login is no probelm but can't retrieve html source code from
opened site.
actually only can read some small html code, such like below.
<html>
<script language=javascript>
location.replace("http://www.naver.com");
</script>
</html>
i want to retrive full html source code..but i can't . i was try with twill
and mechanize and urllib and so on.
i have no idea.. anyone can help me?
here is full source code.
and Thanks in advance!
# -*- coding: cp949 -*-
import sys,os
import mechanize, urllib
import cookielib
import re
import BeautifulSoup
params = urllib.urlencode({'url':'http://www.naver.com',
'svctype':'',
'viewtype':'',
'postDataKey':'',
'encpw':'3a793b174d976d8a614467eb0466898230f39ca68a8ce2e9c866f9c303e7c96a17c0e9bfd02b958d88712f5799abc5d26d5b6e2dfa090e10e236f2afafb723d42d2a2aba6cc3f268e214a169086af782c22d0c440c876a242a4411860dd938c4051acce987',
'encnm':'100003774',
'saveID':'0',
'enctp':'1',
'smart_level':'1',
'id':'lbu142vj',
'pw':'wbelryl',
'x':'24',
'y':'4'
})
rq = mechanize.Request("http://nid.naver.com/nidlogin.login", params)
rs = mechanize.urlopen(rq)
data = rs.read()
print data
rq = mechanize.Request("http://mail2.naver.com")
rs = mechanize.urlopen(rq)
data = rs.read()
print data