--- title: "Configure the Advanced I/O function" url: https://docs.catalyst.zoho.com/en/tutorials/newsapp/python/configure-advancedio/ description: "Build a web news application that automatically fetches news from a third-party service periodically using the Catalyst Job Scheduling Cron component, and a Job Function and Advanced I/O function coded in Python." last_updated: 2025-11-19T15:07:41Z service: All Services type: tutorial related_links: - name: "Advanced I/O Function" url: /en/serverless/help/functions/advanced-io - name: "Data Store" url: /en/cloud-scale/help/data-store/introduction - name: "ZCQL" url: /en/cloud-scale/help/zcql/introduction --- # Configure the Advanced I/O Function The Advanced I/O function directory (`functions/news_app_function`) contains the following files: * The `main.py` main function file * The `catalyst-config.json` configuration file * [requirements.txt](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/functions-directory/#python-modules-and-function-dependencies) file #### Add Code You will be adding code in the `main.py` file. The Advanced I/O function fetches the news item from its source table in the Data Store and forwards it to the client component as a JSON response. Copy the code and paste it in the `main.py` in the `functions/news_app_function ` directory. **main.py** ```python import logging from flask import Request, make_response, jsonify import zcatalyst_sdk def handler(request: Request): #Initializing Catalyst SDK app = zcatalyst_sdk.initialize() logger = logging.getLogger() # GET API that gets the news from the required table if request.path == "/fetchData": table_name = request.args.get("tablename") logger.info("Fetching news from datastore table - "+table_name) zcql_instance = app.zcql() # Query to fetch news from table query = "Select title,url from "+table_name #Queries the Catalyst Data Store table and gets the required news zcql_result = zcql_instance.execute_query(query) return jsonify({"content": zcql_result}), 200 else: # For undefined path error will be thrown response = make_response('Unknown path') response.status_code = 400 return response ``` The Advanced I/O function is now configured. We will discuss the application's architecture after we configure the client.