'How to get field masks that are in google ads api response?

I am trying to get information from google ads API SDK with python. I need to access information that is in the metrics section, some of these are not available directly in response. this information is available in field mask and I can't understand how to get those.

Google Ads Query:

"""
SELECT 
    metrics.average_cost, 
    metrics.all_conversions, 
    metrics.average_cpv, 
    metrics.average_cpm, 
    metrics.average_cpe, 
    metrics.average_cpc 
FROM campaign 
""" 

Response:

SearchPager<
results {
  campaign {
    resource_name: "customers/**********/campaigns/***********"
  }
  metrics {
    all_conversions: 0.0
  }
}
results {
  campaign {
    resource_name: "customers/**********/campaigns/***********"
  }
  metrics {
    all_conversions: 0.0
  }
}
field_mask {
  paths: "metrics.average_cost"
  paths: "metrics.all_conversions"
  paths: "metrics.average_cpv"
  paths: "metrics.average_cpm"
  paths: "metrics.average_cpe"
  paths: "metrics.average_cpc"
}
>



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source