We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 93752e5 commit 20239a0Copy full SHA for 20239a0
webreader.py
@@ -4,18 +4,22 @@
4
5
def readURL(url):
6
start_time = time.time()
7
- f = urlopen(url)
+ f = urlopen(url, timeout=3)
8
myfile = f.read()
9
end_time = time.time()
10
return str(int(round((end_time-start_time)*1000, 0))) + "ms - " + url + "\n"
11
12
+print("Testing URLs...")
13
stream = open("sites.yaml", "r")
14
docs = yaml.load(stream, Loader=yaml.FullLoader)
15
16
outputfile = open("outputfile.txt", "w")
17
18
for doc in docs['sites']:
19
+ print("Testing " + doc)
20
try:
21
outputfile.write(readURL(doc))
22
except:
- outputfile.write("Timeout Error on " + doc)
23
+ outputfile.write("Timeout Error on " + doc + "\n")
24
+
25
+print("Testing Complete.\nResults written to outputfile.txt")
0 commit comments