Skip to content

Instantly share code, notes, and snippets.

@ssrlive
Created April 24, 2022 03:00
Show Gist options
  • Save ssrlive/e3957ae430b0ef1ab9bae57d3d130b53 to your computer and use it in GitHub Desktop.
Save ssrlive/e3957ae430b0ef1ab9bae57d3d130b53 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import http.client
def main(argv):
if len(argv) != 2 :
print("\nUsage: ", argv[0], " <hostname>")
print("\n- <hostname> looks like www.python.org\n")
sys.exit(1)
conn = http.client.HTTPSConnection(argv[1])
conn.request("GET", "/")
r1 = conn.getresponse()
print(r1.status, r1.reason)
data1 = r1.read()
#print(data1)
conn.close()
if __name__ == "__main__" :
main(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment