문제

I was thinking about making an application that scrapes pages of my linksys router administration website. But since this is protected using a java login dialog I'm not able to get the webpage, look for elements (username, password) and then submit the data. Is there another way to do this?

Kind regards, Tobias

도움이 되었습니까?

해결책

The following python code allowed me to extract the status page from my Linksys model WRT320N router:

import urllib2
from base64 import encodestring

LOGIN  = 'admin'
PASSWD = '<your router password>'
URL    = 'http://<router IP address>/Status_Router.asp'

url    = urllib2.Request(URL)
b64str = encodestring('%s:%s' % (LOGIN, PASSWD))[:-1]
url.add_header("Authorization", "Basic %s" % b64str)


f = urllib2.urlopen(url)
for line in f.readlines():
    print line,

f.close()

I was also able to do it with the "wget" utility using the user and password options.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top