I'm trying to grab a hold of some data from a GTFS feed. I haven't gotten very far yet and I'm still trying to figure out how to open up and save the contents locally. Right now I have a flask application with the following:
def mta():
data = urllib2.urlopen('http://addresshere.php?key=keyvaluehere')
response = data.read()
print response
@app.route('/')
def index():
test = mta()
return render_template("index.html",
test = test,
title = "Home")
When I start up the server, it shows up in the console instead of my browser and I get a message that says "None" in the index.html template.
I did a quick test in PHP using get_file_contents() and actually pulled info, albeit, it looked like gibberish to me. Either way, I'm not sure why "None" is showing up in my template. The terminal is displaying the following as soon as I start up the server (which is similar to what I got using PHP)
11!??????"L15S(?>
11!??????"L16S(?>
11!??????"L17S(?>
11!??????"L19S(?>
11!??????"L20S(?>
On another note, should I set up the mta function as a separate module in the application and import it into the view?