mik-laj commented on a change in pull request #8503:
URL: https://github.com/apache/airflow/pull/8503#discussion_r412522783



##########
File path: airflow/providers/facebook/ads/hooks/ads.py
##########
@@ -74,27 +74,26 @@ def __init__(
     def _get_service(self) -> FacebookAdsApi:
         """ Returns Facebook Ads Client using a service account"""
         config = self.facebook_ads_config
-        missings = [_each for _each in self.client_required_fields if _each 
not in config]
-        if missings:
-            message = "{missings} fields are missing".format(missings=missings)
-            raise AirflowException(message)
         return FacebookAdsApi.init(app_id=config["app_id"],
                                    app_secret=config["app_secret"],
                                    access_token=config["access_token"],
                                    account_id=config["account_id"],
                                    api_version=self.api_version)
 
     @cached_property
-    def facebook_ads_config(self) -> None:
+    def facebook_ads_config(self) -> Dict:
         """
         Gets Facebook ads connection from meta db and sets
         facebook_ads_config attribute with returned config file
         """
         self.log.info("Fetching fb connection: %s", self.facebook_conn_id)
         conn = self.get_connection(self.facebook_conn_id)
-        if "facebook_ads_client" not in conn.extra_dejson:
-            raise AirflowException("facebook_ads_client not found")
-        return conn.extra_dejson["facebook_ads_client"]
+        config = conn.extra_dejson
+        missings = [_each for _each in self.client_required_fields if _each 
not in config]

Review comment:
       ```suggestion
           missings_keys = self.client_required_fields - 
conn.extra_dejson.keys()
   ```
   Will it not be easier?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to