This forum is now read-only. Please use our new forums at

333 points
Submitted by
almost 4 years ago

I don't understand what to do in this exercise

I totally have no idea of what to do.

Here is the exercise :

Edit the url we use to call the API.

Change the output format to rss.

Instead of requiring stories with audio, require stories with text.

Hit Save & Submit Code and follow the prompts to output your valid RSS feed XML.

The hint only talks about something with text.

My code:

from urllib2 import urlopen
from urllib import quote

key = "API_KEY"
url = ''
url += key + '&numResults=3&action=or&requiredAssets=audio&format=Podcast'

nprid = rawinput("Enter comma-separated NPR IDs or leave blank." )
searchstring = rawinput("Enter your search string or leave blank.")
feedtitle = rawinput("What's your feed title?")

if nprid or searchstring:
rawinput("Hit Enter to download your podcast.")
if npr
url = url + "&id=" + nprid
if search
url = url + "&searchTerm=" + quote(searchstring)
if feed
url = url + "&title="
response = urlopen(url)
output =
myfeed = open('myfeed.xml', 'w')
raw_input("You must enter an NPR ID, a search term, or both.")

Do anyone have any idea of what to do?

0 votes


I got past this part but I wasn't sure if I was correct (sometimes it lets me pass without my answer being correct).

What I did was in the line
url += key + '&numResults=3&action=or&requiredAssets=audio&format=Podcast'
I changed requiredAssets=text and format=rss
Also my "or" used a capital o "Or" but I don't know if that matters at all.

1675 points
Submitted by
almost 4 years ago