Last active
July 18, 2017 20:07
-
-
Save jaitjacob/cd3e76c9221ca5b3d3c19adabea1f120 to your computer and use it in GitHub Desktop.
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
| #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