Skip to content

Create API response parser

If your API client returns lists of structures that are not similar to dictionaries, you might need to implement a custom parser based on garf_core.parsers.BaseParser.

Define Parser class

The only method you need to implement is parse_row.

from garf_core.parsers import BaseParser

class MyParser(BaseParser):

  def parse_row(row):
    # Your parsing logic here

Use with ApiReportFetcher

Once your Parser class is defined, you can use with built-in ApiReportFetcher.

from garf_core import ApiReportFetcher

report_fetcher = ApiReportFetcher(api_client, parser=MyParser)

Note

Learn more about using ApiReportFetcher.