| :py:mod:`airflow.providers.facebook.ads.hooks.ads` |
| ================================================== |
| |
| .. py:module:: airflow.providers.facebook.ads.hooks.ads |
| |
| .. autoapi-nested-parse:: |
| |
| This module contains Facebook Ads Reporting hooks |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.facebook.ads.hooks.ads.JobStatus |
| airflow.providers.facebook.ads.hooks.ads.FacebookAdsReportingHook |
| |
| |
| |
| |
| .. py:class:: JobStatus |
| |
| Bases: :py:obj:`enum.Enum` |
| |
| Available options for facebook async task status |
| |
| .. py:attribute:: COMPLETED |
| :annotation: = Job Completed |
| |
| |
| |
| .. py:attribute:: STARTED |
| :annotation: = Job Started |
| |
| |
| |
| .. py:attribute:: RUNNING |
| :annotation: = Job Running |
| |
| |
| |
| .. py:attribute:: FAILED |
| :annotation: = Job Failed |
| |
| |
| |
| .. py:attribute:: SKIPPED |
| :annotation: = Job Skipped |
| |
| |
| |
| |
| .. py:class:: FacebookAdsReportingHook(facebook_conn_id = default_conn_name, api_version = None) |
| |
| Bases: :py:obj:`airflow.hooks.base.BaseHook` |
| |
| Hook for the Facebook Ads API |
| |
| .. seealso:: |
| For more information on the Facebook Ads API, take a look at the API docs: |
| https://developers.facebook.com/docs/marketing-apis/ |
| |
| :param facebook_conn_id: Airflow Facebook Ads connection ID |
| :param api_version: The version of Facebook API. Default to None. If it is None, |
| it will use the Facebook business SDK default version. |
| |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = facebook_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = facebook_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = facebook_social |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = Facebook Ads |
| |
| |
| |
| .. py:method:: multiple_accounts(self) |
| |
| Checks whether provided account_id in the Facebook Ads Connection is provided as a list |
| |
| |
| .. py:method:: facebook_ads_config(self) |
| |
| Gets Facebook ads connection from meta db and sets |
| facebook_ads_config attribute with returned config file |
| |
| |
| .. py:method:: bulk_facebook_report(self, params, fields, sleep_time = 5) |
| |
| Pulls data from the 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. |
| |
| :param fields: List of fields that is obtained from Facebook. Found in AdsInsights.Field class. |
| https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0 |
| :param params: Parameters that determine the query for Facebook |
| https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0 |
| :param sleep_time: Time to sleep when async call is happening |
| |
| :return: Facebook Ads API response, |
| converted to Facebook Ads Row objects regarding given Account ID type |
| :rtype: List[AdsInsights] or Dict[str, List[AdsInsights]] |
| |
| |
| |