Created
November 6, 2012 04:10
-
-
Save yaojialyu/4022485 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import urllib2 | |
import time | |
def main(): | |
opener = urllib2.build_opener() | |
while 1: | |
request = urllib2.Request('http://xinhuanet.com/') | |
page = opener.open(request) | |
print page.code | |
print 'sleeping...' | |
time.sleep(60) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment