We proceed with the recipe as follows:
- The code of the API for this recipe is in 09/02/api.py. This extends the code in the previous recipe to make a call to this function in the sojobs module. The code for the service is the following:
from flask import Flaskfrom flask_restful import Resource, Apifrom sojobs.scraping import get_job_listing_infoapp = Flask(__name__)api = Api(app)class JobListing(Resource): def get(self, job_listing_id): print("Request for job listing with id: " + job_listing_id) listing = get_job_listing_info(job_listing_id) print("Got the following listing as a response: " + listing) return listingapi.add_resource(JobListing, '/', '/joblisting/<string:job_listing_id>')if __name__ == '__main__': print("Starting ...