Created
February 14, 2013 14:16
-
-
Save sooop/4953096 to your computer and use it in GitHub Desktop.
getpage.py : connect some URL and print html source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#-*-coding:utf-8 | |
import urllib | |
import sys | |
def printHTML(): | |
if len(sys.argv) < 2: | |
print("usage checkURL.py http://some.site.addr") | |
exit(1) | |
s = argv[1] | |
m = urllib.urlopen(s) | |
c = m.readline() | |
while c: | |
print c | |
c = m.readline() | |
m.close() | |
if __name__ == "__main__": | |
printHTML() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment