문제

I have a small network which includes multiple PCs and projectors. Normally, I am able to see the projector status(running time, lamp life, etc) via browser when i typed in the ip address of particular projector. I am wondering if it is possible to fetch the information of the projectors on the network using a python script. My idea is to create a small tkinter app which will display those projector status when the user request.I must admit that i am being too ambitious as i don't have enough knowledge on network programming. But if any of you can help me out , i will greatly appreciate.

도움이 되었습니까?

해결책

It sort of depends on how complicated the page is. If it's plain text, then something like this should work

import urllib
stats_text = urllib.urlopen('http://ip.of.projector').read()

If you need to parse the returned page at all to extract the values, you might want to look at BeautifulSoup

다른 팁

you can do it several ways, but since you have not given so much information I would recommend going with mechanize or splinter, both work as a browser so you can read what's on the HTML and even fill/submit forms and much more.

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