Skip to content

Commit f721b4e

Browse files
committed
Error code #1
1 parent 060f454 commit f721b4e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/python3
2+
'''
3+
That takes in a URL, sends a request to the URL
4+
and displays the body of the response.
5+
'''
6+
import requests
7+
import sys
8+
9+
if __name__ == "__main__":
10+
response = requests.get(sys.argv[1])
11+
stat_code = response.status_code
12+
if stat_code > 400:
13+
print('Error code: {}'.format(stat_code))
14+
else:
15+
print('{}'.format(response.text))
16+
17+
18+

0 commit comments

Comments
 (0)