Skip to content

Instantly share code, notes, and snippets.

@flufy3d
Created June 13, 2012 04:51
Show Gist options
  • Save flufy3d/2921921 to your computer and use it in GitHub Desktop.
Save flufy3d/2921921 to your computer and use it in GitHub Desktop.
python3 get url test example code
import urllib.request
from time import sleep
url="http://172.17.73.206/st/index.php?action=s"
while 1:
try:
sleep(0.1)
print('get http://172.17.73.206/st/index.php?action=s')
response=urllib.request.urlopen(url)
#page=response.read()
except urllib.error.URLError as e1:
print(e1.reason)
except urllib.error.HTTPError as e2:
print(e2.code)
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment