am_dot_com

FP 2021-12-07

Dec 7th, 2021 (edited)
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import sys
  2. from urllib.request import urlopen
  3.  
  4. #dna.py
  5. #Domain Name Available ?
  6. """
  7. Console App
  8. Receives a domain name
  9. Prints:
  10. "http available" if there is http content at the domain
  11. "http not available" if there is NOT http content at the domain
  12. """
  13.  
  14. bCorrectUsage = len(sys.argv)==2
  15. if (bCorrectUsage):
  16. strDomainName = sys.argv[1]
  17. try:
  18. strHttpsForDomain = \
  19. "http://"+strDomainName
  20.  
  21. urlopen(strHttpsForDomain)
  22. print ("HTTP available!")
  23. except:
  24. print ("HTTP NOT available")
  25.  
  26. #TODO
  27. else:
  28. pass
  29. #TODO : explain how to use
  30.  
Advertisement
Add Comment
Please, Sign In to add comment