Пример #1
0
 def __init__(
     self,
     client_id,
     client_secret,
     tech_account_id,
     org_id,
     private_key,
     global_company_id,
     report_suite_id,
     dimension,
     metric,
     start_date,
     end_date,
     date_range,
 ):
     self.adobe_client = AdobeAnalyticsClient(client_id, client_secret,
                                              tech_account_id, org_id,
                                              private_key)
     self.global_company_id = global_company_id
     self.report_suite_id = report_suite_id
     self.dimensions = list(dimension)
     self.metrics = list(metric)
     self.start_date, self.end_date = build_date_range(
         start_date, end_date, date_range)
     self.end_date = self.end_date + timedelta(days=1)
     self.ingestion_tracker = []
     self.node_values = {}
 def __init__(
     self,
     access_token,
     client_id,
     client_secret,
     refresh_token,
     agency_id,
     advertiser_ids,
     report_name,
     report_type,
     columns,
     saved_columns,
     start_date,
     end_date,
     date_range,
 ):
     self.sa360_client = GoogleSA360Client(access_token, client_id,
                                           client_secret, refresh_token)
     self.agency_id = agency_id
     self.advertiser_ids = list(advertiser_ids)
     self.report_name = report_name
     self.report_type = report_type
     self.columns = list(columns)
     self.saved_columns = list(saved_columns)
     self.all_columns = self.columns + self.saved_columns
     self.start_date, self.end_date = build_date_range(
         start_date, end_date, date_range)
    def __init__(
        self,
        client_id,
        client_secret,
        access_token,
        refresh_token,
        dimensions,
        site_url,
        start_date,
        end_date,
        date_column,
        row_limit,
        date_range,
    ):
        self.client_id = client_id
        self.client_secret = client_secret
        self.access_token = access_token
        self.refresh_token = refresh_token
        self.dimensions = list(dimensions)
        self.site_url = site_url
        self.start_date, self.end_date = build_date_range(
            start_date, end_date, date_range)
        self.with_date_column = date_column
        self.row_limit = row_limit

        self._service = None
        self.is_api_ready = False
        self.start_row = 0
Пример #4
0
 def __init__(self, client_id, client_secret, refresh_token, request_type, date_range, start_date, end_date, **kwargs):
     self.client_id = client_id
     self.client_secret = client_secret
     self.agency_client_token = {"refresh_token": refresh_token}
     self.request_type = request_type
     self.start_date, self.end_date = build_date_range(start_date, end_date, date_range)
     self.date_format = kwargs.get("date_format")
     self.date_are_valid = self.__check_date_input_validity()
     self.__retrieve_and_set_token()
Пример #5
0
    def __init__(
        self,
        consumer_key,
        consumer_secret,
        access_token,
        access_token_secret,
        account_id,
        report_type,
        entity,
        entity_attribute,
        granularity,
        metric_group,
        placement,
        segmentation_type,
        platform,
        country,
        start_date,
        end_date,
        add_request_date_to_report,
        date_range,
    ):
        # Authentication inputs
        self.client = Client(consumer_key, consumer_secret, access_token,
                             access_token_secret)
        self.account = self.client.accounts(account_id)

        # General inputs
        self.report_type = report_type
        self.entity = entity
        self.start_date, self.end_date = build_date_range(
            start_date, end_date, date_range)
        self.end_date = self.end_date + timedelta(days=1)
        self.add_request_date_to_report = add_request_date_to_report

        # Report inputs: ENTITY
        self.entity_attributes = list(entity_attribute)

        # Report inputs: ANALYTICS
        self.granularity = granularity
        self.metric_groups = list(metric_group)
        self.placement = placement
        self.segmentation_type = segmentation_type
        self.platform = platform
        self.country = country

        # Validate inputs
        self.validate_inputs()
 def __init__(
     self,
     login,
     password,
     advertiser_id,
     report_template_name,
     report_schedule_name,
     start_date,
     end_date,
     date_range,
 ):
     self.login = login
     self.password = password
     self._build_headers()
     self.advertiser_ids = list(advertiser_id)
     self.report_template_name = report_template_name
     self.report_schedule_name = report_schedule_name
     self.start_date, self.end_date = build_date_range(
         start_date, end_date, date_range)
     # Report end date is exclusive: to become inclusive, it should be incremented by 1 day
     self.end_date = self.end_date + timedelta(days=1)
 def __init__(
     self,
     access_token,
     client_id,
     client_secret,
     refresh_token,
     profile_ids,
     report_name,
     report_type,
     metrics,
     dimensions,
     start_date,
     end_date,
     filters,
     date_range,
 ):
     self.dcm_client = GoogleDCMClient(access_token, client_id, client_secret, refresh_token)
     self.profile_ids = list(profile_ids)
     self.report_name = report_name
     self.report_type = report_type
     self.metrics = list(metrics)
     self.dimensions = list(dimensions)
     self.start_date, self.end_date = build_date_range(start_date, end_date, date_range)
     self.filters = list(filters)
 def test_build_date_range_with_dates(self):
     self.assertTupleEqual(
         build_date_range(datetime(2021, 1, 1), datetime(2021, 1, 31),
                          None),
         (datetime(2021, 1, 1), datetime(2021, 1, 31)))
 def test_build_date_range_without_dates(self):
     self.assertTupleEqual(build_date_range(None, None, "PREVIOUS_MONTH"),
                           (datetime(2021, 1, 1), datetime(2021, 1, 31)))