Skip to content

Instantly share code, notes, and snippets.

@jaitjacob
Last active July 18, 2017 20:07
Show Gist options
  • Select an option

  • Save jaitjacob/cd3e76c9221ca5b3d3c19adabea1f120 to your computer and use it in GitHub Desktop.

Select an option

Save jaitjacob/cd3e76c9221ca5b3d3c19adabea1f120 to your computer and use it in GitHub Desktop.
#Program : A tool for downloading Requesting for Comments (RFC) documents #from IETF, and then display them on screen.
#Author : Jait Jacob
#Date : 07/04/2017
import sys,urllib.request
try:
rfc_number=int(sys.argv[1])
except(IndexError, ValueError): #incase you don't pass a RFC number or you #pass an invalid RFC number this error is called upon
print('RFC number not supplied')
sys.exit(2)
template='http://www.ietf.org/rfc/rfc{}.txt'
url = template.format(rfc_number)
rfc_raw=urllib.request.urlopen(url).read()
rfc=rfc_raw.decode()
print(rfc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment