Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 946a271

Browse files
committed
Add website connectivity checker
1 parent 0bb4cde commit 946a271

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import requests
2+
import csv
3+
4+
status_dict={'Website': 'Status'}
5+
6+
if __name__ == '__main__':
7+
8+
with open('websites.txt', 'r') as fr:
9+
for line in fr:
10+
status=requests.get(line.strip()).status_code
11+
status_dict[line] = 'working' if status==200 else 'not working'
12+
13+
print(status_dict)
14+
with open('website_status.csv', 'w', newline='') as fw:
15+
csv_writers = csv.writer(fw)
16+
for key in status_dict.keys():
17+
csv_writers.writerow([key, status_dict[key]])
18+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Website,Status
2+
"http://web.hike.com/
3+
",working
4+
"https://github.com/chavarera/python-mini-projects/issues/96
5+
",working
6+
"https://www.youtube.com/
7+
",working
8+
"https://dillinger.io/
9+
",working
10+
https://pypi.org/,working
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
http://web.hike.com/
2+
https://github.com/chavarera/python-mini-projects/issues/96
3+
https://www.youtube.com/
4+
https://dillinger.io/
5+
https://pypi.org/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /