Created
September 25, 2021 20:23
-
-
Save froop/9dc5c0a76cf24c22cd03c26c3497c815 to your computer and use it in GitHub Desktop.
[Python] HTTP GET minimum (Python 2.7)
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 httplib | |
con = httplib.HTTPConnection('172.31.1.12', 80) | |
con.request('GET', '/') | |
res = con.getresponse() | |
print(res.status) |
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 requests | |
res = requests.get('http://172.31.1.12/') | |
print(res.status_code) |
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 | |
req = urllib2.Request('http://172.31.1.12/') | |
res = urllib2.urlopen(req) | |
print(res.getcode()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment