airflow.providers.facebook.ads.hooks.ads
¶
This module contains Facebook Ads Reporting hooks.
Module Contents¶
Classes¶
Available options for facebook async task status. |
|
Facebook Ads API. |
- class airflow.providers.facebook.ads.hooks.ads.JobStatus[source]¶
Bases:
enum.Enum
Available options for facebook async task status.
- class airflow.providers.facebook.ads.hooks.ads.FacebookAdsReportingHook(facebook_conn_id=default_conn_name, api_version=None)[source]¶
Bases:
airflow.hooks.base.BaseHook
Facebook Ads API.
See also
For more information on the Facebook Ads API, take a look at the API docs: https://developers.facebook.com/docs/marketing-apis/
- Parameters
- multiple_accounts()[source]¶
Check whether provided account_id in the Facebook Ads Connection is provided as a list.
- facebook_ads_config()[source]¶
Get the
facebook_ads_config
attribute.This fetches Facebook Ads connection from meta database, and sets the
facebook_ads_config
attribute with returned config file.
- bulk_facebook_report(params, fields, sleep_time=5)[source]¶
Pull data from Facebook Ads API regarding Account ID with matching return type.
The return type and value depends on the
account_id
configuration. If the configuration is a str representing a single Account ID, the return value is the list of reports for that ID. If the configuration is a list of str representing multiple Account IDs, the return value is a dict of Account IDs and their respective list of reports.- Parameters
fields (list[str]) – List of fields that is obtained from Facebook. Found in AdsInsights.Field class. https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0
params (dict[str, Any] | None) – Parameters that determine the query for Facebook https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0
sleep_time (int) – Time to sleep when async call is happening
- Returns
Facebook Ads API response, converted to Facebook Ads Row objects regarding given Account ID type
- Return type
list[facebook_business.adobjects.adsinsights.AdsInsights] | dict[str, list[facebook_business.adobjects.adsinsights.AdsInsights]]