So I installed Postman like it said and now I copied the example code line for line. It should find the file but when I browse to the API I'm building with it gives me a 404 error:
#let's import the flask
from flask import Flask, Response
import json
import os
app = Flask(__name__)
@app.route('/apu/v1.0/students', methods = ['GET'])
def students():
student_list = [
{
'name':'Asabeneh',
'country':'Finland',
'city':'Helsinki',
'skills':['HTML','CSS','JavaScript','Python']
},
{
'name':'David',
'country':'UK',
'city':'London',
'skills':['Python', 'MongoDB']
},
{
'name':'John',
'country':'Sweden',
'city':'Stockholm',
'skills':['Java','C#']
}
]
return Response(json.dumps(student_list), mimetype='application/json')
if __name__ == '__main__':
# for deployment
#to make it work for both production and development
port = int(os.environ.get("PORT", 5000))
app.run(debug=True, host='0.0.0.0', port=port)
This is for the last challenge of this course:
https://github.com/Asabeneh/30-Days-Of-Python/blob/master/29_Day_Building_API/29_building_API.md
The file is saved as Day 29.py I always run the program before trying to access it in my browser and it appears to run just fine but browser can't find the program. I don't think the issue is with the code itself as much as the browser being able to see the code.