Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RFC downloader not working
#1
I am using the following code to download rfc pages. I am however getting
only html and not plain English text like on the webpage http://www.ietf.org/rfc/rfc2324.txt


In the command prompt I type:

python "RFC-Downloader.py" 2324 | more

import sys, urllib.request
try:
    rfc_number = int(sys.argv[1])
except (IndexError, ValueError):
    print('Must supply an RFC number as first argument')
    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)
Reply


Messages In This Thread
RFC downloader not working - by sidsr003 - Dec-19-2018, 01:29 PM
RE: RFC downloader not working - by Larz60+ - Dec-19-2018, 04:06 PM
RE: RFC downloader not working - by snippsat - Dec-19-2018, 09:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  m3u8 using build-in browser downloader? kucingkembar 3 760 Mar-29-2024, 01:47 AM
Last Post: kucingkembar
  Can not make this image downloader work Blue Dog 6 4,296 Jun-23-2020, 08:55 PM
Last Post: snippsat
  Multiple File Downloader Josh_Python890 1 2,607 Sep-16-2017, 11:19 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020