Exemplo n.º 1
0
    def __init__(self, access_token, client_name, client_login=""):
        self.url = "https://api.direct.yandex.com/json/v5/"
        self.client_login = client_login
        self.client_name = client_name
        self.headers_report = {
            "Authorization": "Bearer " + access_token,
            "Accept-Language": "ru"
        }

        self.report_dict = {
            "CLIENTS": {
                "fields": {
                    'ClientId': "STRING",
                    'Login': "******",
                    'ClientInfo': "STRING"
                }
            },
            "CAMPAIGNS": {
                "fields": {
                    "Name": "STRING",
                    "Id": "STRING",
                    "Type": "STRING"
                }
            },
            "ADGROUPS": {
                "fields": {
                    "Id": "STRING",
                    "Name": "STRING",
                    "CampaignId": "STRING",
                    "Type": "STRING"
                }
            },
            "ADS": {
                "fields": {
                    "Type": "STRING",
                    "Text": "STRING",
                    "Title": "STRING",
                    "DisplayDomain": "STRING",
                    "Href": "STRING",
                    "DisplayUrlPath": "STRING",
                    "Title2": "STRING",
                    "AdCategories": "STRING",
                    "AdGroupId": "STRING",
                    "CampaignId": "STRING",
                    "Id": "STRING"
                }
            },
            "KEYWORD": {
                "fields": {
                    "Id": "STRING",
                    "Keyword": "STRING",
                    "AdGroupId": "STRING",
                    "CampaignId": "STRING"
                }
            }
        }

        self.tables_with_schema, self.string_fields, self.integer_fields, \
        self.float_fields = create_fields(client_name, "YandexDirect", self.report_dict)
Exemplo n.º 2
0
    def __init__(self, access_token, account_id, client_id, client_name):
        self.__access_token = access_token
        self.__v = "5.101"
        self.__method_url = "https://api.vk.com/method/"
        self.account_id = account_id
        self.client_id = client_id

        self.report_dict = {
            "CAMPAIGNS": {
                "fields": {"id": "STRING", "type": "STRING", "name": "STRING",
                           "status": "STRING", "day_limit": "FLOAT", "all_limit": "FLOAT",
                           "start_time": "STRING", "stop_time": "STRING", "create_time": "STRING",
                           "update_time": "STRING", "views_limit": "STRING"}},
            "ADS": {
                "fields": {"id": "STRING", "campaign_id": "STRING", "status": "STRING", "approved": "STRING",
                           "create_time": "STRING", "update_time": "STRING", "goal_type": "STRING",
                           "cost_type": "STRING", "day_limit": "FLOAT", "all_limit": "FLOAT", "start_time": "STRING",
                           "stop_time": "STRING", "category1_id": "STRING", "category2_id": "STRING",
                           "age_restriction": "STRING", "name": "STRING", "events_retargeting_groups": "STRING",
                           "ad_format": "STRING", "cpc": "FLOAT", "ad_platform": "STRING", "cpm": "FLOAT",
                           "impressions_limit": "INTEGER", "ad_platform_no_ad_network": "STRING", "ocpm": "FLOAT",
                           "weekly_schedule_use_holidays": "STRING", "weekly_schedule_hours": "STRING",
                           "impressions_limited": "STRING", "ad_platform_no_wall": "STRING",
                           "autobidding_max_cost": "STRING", "autobidding": "STRING"}},

            "CAMPAIGN_STAT": {
                "fields": {"day": "STRING", "spent": "FLOAT", "impressions": "INTEGER", "clicks": "INTEGER",
                           "reach": "INTEGER", "join_rate": "INTEGER", "campaign_id": "STRING", 'lead_form_sends': "STRING",
                           'goals': "STRING"}},

            "ADS_STAT": {
                "fields": {"ad_id": "STRING", "clicks": "INTEGER", "day": "STRING", "impressions": "INTEGER",
                           "join_rate": "FLOAT", "reach": "INTEGER", "spent": "FLOAT", 'lead_form_sends': "INTEGER",
                           'goals': "INTEGER"}},
            "SEX_STAT": {
                "fields": {"impressions_rate": "FLOAT", "clicks_rate": "FLOAT", "value": "STRING",
                           "ad_id": "STRING", "day": "STRING"}},
            "AGE_STAT": {
                "fields": {"impressions_rate": "FLOAT", "clicks_rate": "FLOAT", "value": "STRING",
                           "ad_id": "STRING", "day": "STRING"}},
            "SEX_AGE_STAT": {
                "fields": {"impressions_rate": "FLOAT", "clicks_rate": "FLOAT", "value": "STRING",
                           "ad_id": "STRING", "day": "STRING"}},
            "CITIES_STAT": {
                "fields": {"impressions_rate": "FLOAT", "clicks_rate": "FLOAT", "value": "STRING",
                           "ad_id": "STRING", "day": "STRING", "name": "STRING"}}}
        self.tables_with_schema, self.string_fields, self.integer_fields, self.float_fields = \
            create_fields(client_name, "VKontakte", self.report_dict)
Exemplo n.º 3
0
    def __init__(self, token, account, client_name):
        self.token = token
        self.account = account

        self.report_dict = {
            "CAMPAIGNS": {
                "fields": {"name": "STRING", "updated_time": "STRING", "created_time": "STRING",
                           "configured_status": "STRING", "effective_status": "STRING", "start_time": "STRING",
                           "stop_time": "STRING", "id": "STRING"}},
            "ADS_STAT": {
                "fields": {"clicks": "INTEGER", "impressions": "INTEGER", "spend": "FLOAT",
                           "video_p100_watched_actions": "INTEGER", "video_p25_watched_actions": "INTEGER",
                           "video_p50_watched_actions": "INTEGER", "video_30_sec_watched_actions": "INTEGER",
                           "video_p75_watched_actions": "INTEGER", "video_p95_watched_actions": "INTEGER",
                           "video_thruplay_watched_actions": "INTEGER", "video_avg_time_watched_actions": "FLOAT",
                           "conversions": "INTEGER", "ad_id": "STRING", "ad_name": "STRING", "campaign_id": "STRING",
                           "campaign_name": "STRING", "adset_id": "STRING", "adset_name": "STRING",
                           "date_start": "STRING", "date_stop": "STRING"}},
            "CAMPAIGN_STAT": {
                "fields": {"clicks": "INTEGER", "impressions": "INTEGER", "spend": "FLOAT", "date_start": "STRING",
                           "date_stop": "STRING", "campaign_id": "STRING", "campaign_name": "STRING",
                           "video_p100_watched_actions": "INTEGER", "video_p25_watched_actions": "INTEGER",
                           "video_p50_watched_actions": "INTEGER", "video_30_sec_watched_actions": "INTEGER",
                           "video_p75_watched_actions": "INTEGER", "video_p95_watched_actions": "INTEGER",
                           "video_thruplay_watched_actions": "INTEGER", "video_avg_time_watched_actions": "FLOAT",
                           "conversions": "INTEGER"}},
            "ADS_BASIC": {
                "fields": {"adset_id": "STRING", "campaign_id": "STRING", "id": "STRING", "name": "STRING",
                           "status": "STRING", "updated_time": "STRING"}},
            "ADS_LAYOUT": {
                "fields": {"page_id": "STRING", "instagram_actor_id": "STRING", "video_id": "STRING",
                           "message": "STRING", "call_to_action_type": "STRING", "link": "STRING",
                           "link_format": "STRING", "attachment_style": "STRING", "image_hash": "STRING",
                           "link_caption": "STRING", "id": "STRING", "caption": "STRING", "ad_id": "STRING"}},
            "ADSETS": {
                "fields": {"campaign_id": "STRING", "id": "STRING", "name": "STRING", "status": "STRING",
                           "start_time": "STRING", "updated_time": "STRING", "created_time": "STRING",
                           "end_time": "STRING"}}}

        self.tables_with_schema, self.string_fields, self.integer_fields, self.float_fields = \
            create_fields(client_name, "Facebook", self.report_dict)
Exemplo n.º 4
0
    def __init__(self, client_id, client_secret, client_name, path_to_json):
        self.client_id = client_id
        self.client_secret = client_secret
        self.client_name = client_name
        self.path_to_json = path_to_json
        self.url = "https://api.hybrid.ru/"
        
        self.report_dict = {
            "CAMPAIGNS": {"fields": {"Id": "STRING", "Name": "STRING"}},

            "CAMPAIGN_STAT": {
                "fields": {"Day": "STRING", "ImpressionCount": "INTEGER", "ClickCount": "INTEGER", "Reach": "INTEGER",
                       "CTR": "FLOAT", "id": "STRING"}},

            "ADVERTISER_STAT": {
                "fields": {"Day": "STRING", "ImpressionCount": "INTEGER", "ClickCount": "INTEGER", "Reach": "INTEGER",
                       "CTR": "FLOAT"}}
        }

        self.tables_with_schema, self.string_fields, self.integer_fields, self.float_fields = \
            create_fields(client_name, "Hybrid")
Exemplo n.º 5
0
    def __init__(self, ct_site_id, ct_token, client_name):
        self.__ct_token = ct_token
        self.__url = f'http://api.calltouch.ru/calls-service/RestAPI/{ct_site_id}/calls-diary/calls'
        self.report_dict = {
            "CALLS": {
                "fields": {
                    'date': "STRING",
                    'callUrl': "STRING",
                    'uniqueCall': "STRING",
                    'utmContent': "STRING",
                    'source': "STRING",
                    'waitingConnect': "FLOAT",
                    'ctCallerId': "STRING",
                    'keyword': "STRING",
                    'utmSource': "STRING",
                    'sipCallId': "STRING",
                    'utmCampaign': "STRING",
                    'phoneNumber': "STRING",
                    'uniqTargetCall': "STRING",
                    'utmMedium': "STRING",
                    'city': "STRING",
                    'yaClientId': "STRING",
                    'medium': "STRING",
                    'duration': "FLOAT",
                    'callbackCall': "STRING",
                    'successful': "STRING",
                    'callId': "STRING",
                    'clientId': "STRING",
                    'callerNumber': "STRING",
                    'utmTerm': "STRING",
                    'sessionId': "STRING",
                    'targetCall': "STRING",
                    'AUTO_PR': "STRING",
                    'MANUAL': "STRING"
                }
            }
        }

        self.tables_with_schema, self.string_fields, self.integer_fields, \
        self.float_fields = create_fields(client_name, "Calltouch", self.report_dict)
Exemplo n.º 6
0
    def __init__(self, agency_access_token, client_name):
        self.agency_access_token = agency_access_token
        self.url = "https://target.my.com/"
        self.report_list = ['base', 'video', 'events', 'uniques']

        self.report_dict = {
            "ADS": {
                "fields": {
                    "campaign_id": "STRING",
                    "id": "STRING",
                    "moderation_status": "STRING"
                }
            },
            "CAMPAIGNS": {
                "fields": {
                    "id": "STRING",
                    "name": "STRING",
                    "package_id": "STRING"
                }
            },
            "BANNER_STAT": {
                "fields": {
                    "clicks": "INTEGER",
                    "clicks_on_external_url": "INTEGER",
                    "comments": "INTEGER",
                    "cpa": "FLOAT",
                    "cpc": "FLOAT",
                    "cpm": "FLOAT",
                    "cr": "FLOAT",
                    "ctr": "FLOAT",
                    "day": "STRING",
                    "depth_of_view": "INTEGER",
                    "fullscreen_off": "INTEGER",
                    "fullscreen_on": "INTEGER",
                    "goals": "INTEGER",
                    "id": "STRING",
                    "joinings": "INTEGER",
                    "launching_video": "INTEGER",
                    "likes": "INTEGER",
                    "measurement_rate": "FLOAT",
                    "moving_into_group": "INTEGER",
                    "opening_app": "INTEGER",
                    "opening_post": "INTEGER",
                    "paused": "INTEGER",
                    "resumed_after_pause": "INTEGER",
                    "sending_form": "INTEGER",
                    "shares": "INTEGER",
                    "shows": "INTEGER",
                    "sound_turned_off": "INTEGER",
                    "sound_turned_on": "INTEGER",
                    "spent": "FLOAT",
                    "started": "INTEGER",
                    "viewed_100_percent": "INTEGER",
                    "viewed_100_percent_cost": "FLOAT",
                    "viewed_100_percent_rate": "FLOAT",
                    "viewed_10_seconds": "INTEGER",
                    "viewed_10_seconds_cost": "FLOAT",
                    "viewed_10_seconds_rate": "FLOAT",
                    "viewed_25_percent": "INTEGER",
                    "viewed_25_percent_cost": "FLOAT",
                    "viewed_25_percent_rate": "FLOAT",
                    "viewed_50_percent": "INTEGER",
                    "viewed_50_percent_cost": "FLOAT",
                    "viewed_50_percent_rate": "FLOAT",
                    "viewed_75_percent": "INTEGER",
                    "viewed_75_percent_cost": "FLOAT",
                    "viewed_75_percent_rate": "FLOAT",
                    "votings": "INTEGER",
                    "vr": "FLOAT"
                }
            },
            "CAMPAIGN_STAT": {
                "fields": {
                    "clicks": "INTEGER",
                    "clicks_on_external_url": "INTEGER",
                    "comments": "INTEGER",
                    "cpa": "FLOAT",
                    "cpc": "FLOAT",
                    "cpm": "FLOAT",
                    "cr": "FLOAT",
                    "ctr": "FLOAT",
                    "day": "STRING",
                    "depth_of_view": "INTEGER",
                    "fullscreen_off": "INTEGER",
                    "fullscreen_on": "INTEGER",
                    "goals": "INTEGER",
                    "id": "STRING",
                    "joinings": "INTEGER",
                    "launching_video": "INTEGER",
                    "likes": "INTEGER",
                    "measurement_rate": "FLOAT",
                    "moving_into_group": "INTEGER",
                    "opening_app": "INTEGER",
                    "opening_post": "INTEGER",
                    "paused": "INTEGER",
                    "resumed_after_pause": "INTEGER",
                    "sending_form": "INTEGER",
                    "shares": "INTEGER",
                    "shows": "INTEGER",
                    "sound_turned_off": "INTEGER",
                    "sound_turned_on": "INTEGER",
                    "spent": "FLOAT",
                    "started": "INTEGER",
                    "viewed_100_percent": "INTEGER",
                    "viewed_100_percent_cost": "FLOAT",
                    "viewed_100_percent_rate": "FLOAT",
                    "viewed_10_seconds": "INTEGER",
                    "viewed_10_seconds_cost": "FLOAT",
                    "viewed_10_seconds_rate": "FLOAT",
                    "viewed_25_percent": "INTEGER",
                    "viewed_25_percent_cost": "FLOAT",
                    "viewed_25_percent_rate": "FLOAT",
                    "viewed_50_percent": "INTEGER",
                    "viewed_50_percent_cost": "FLOAT",
                    "viewed_50_percent_rate": "FLOAT",
                    "viewed_75_percent": "INTEGER",
                    "viewed_75_percent_cost": "FLOAT",
                    "viewed_75_percent_rate": "FLOAT",
                    "votings": "INTEGER",
                    "vr": "FLOAT"
                }
            },
            "CAMPAIGN_REACH": {
                "fields": {
                    "id": "STRING",
                    "day": "STRING",
                    "reach": "INTEGER",
                    "total": "INTEGER",
                    "increment": "INTEGER",
                    "frequency": "FLOAT"
                }
            },
            "BANNER_REACH": {
                "fields": {
                    "id": "STRING",
                    "day": "STRING",
                    "reach": "INTEGER",
                    "total": "INTEGER",
                    "increment": "INTEGER",
                    "frequency": "FLOAT"
                }
            }
        }

        self.tables_with_schema, self.string_fields, self.integer_fields, self.float_fields = \
            create_fields(client_name, "MyTarget", self.report_dict)
Exemplo n.º 7
0
    def __init__(self, access_token, client_login, client_name):
        self.url = "https://api.direct.yandex.com/json/v5/"
        self.headers_report = {
            "Authorization": "Bearer " + access_token,
            "Client-Login": client_login,
            "Accept-Language": "ru",
            "processingMode": "auto",
            "returnMoneyInMicros": "false",
            "skipReportHeader": "true",
            "skipReportSummary": "true"
        }

        self.report_dict = {
            "CAMPAIGN_STAT": {
                "type": "CUSTOM_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "CAMPAIGN_DEVICE_AND_PLACEMENT_STAT": {
                "type": "CUSTOM_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignType": "STRING",
                    "CampaignName": "STRING",
                    "AdNetworkType": "STRING",
                    "Device": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "CAMPAIGN_GEO_STAT": {
                "type": "CAMPAIGN_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "LocationOfPresenceName": "STRING",
                    "TargetingLocationId": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "CAMPAIGN_PLACEMENT_STAT": {
                "type": "CAMPAIGN_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "Placement": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "CAMPAIGN_SOCDEM_DEVICE_STAT": {
                "type": "CAMPAIGN_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "Device": "STRING",
                    "CarrierType": "STRING",
                    "CampaignType": "STRING",
                    "MobilePlatform": "STRING",
                    "Age": "STRING",
                    "Gender": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "AD_STAT": {
                "type": "AD_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "AdId": "STRING",
                    "AdFormat": "STRING",
                    "AdGroupId": "STRING",
                    "AdGroupName": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "AD_DEVICE_STAT": {
                "type": "AD_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "AdId": "STRING",
                    "AdFormat": "STRING",
                    "AdGroupId": "STRING",
                    "AdGroupName": "STRING",
                    "Device": "STRING",
                    "AdNetworkType": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "REACH_AND_FREQUENCY_STAT": {
                "type": "REACH_AND_FREQUENCY_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "AdGroupId": "STRING",
                    "AdGroupName": "STRING",
                    "AdId": "STRING",
                    "Impressions": "INTEGER",
                    "ImpressionReach": "INTEGER",
                    "AvgImpressionFrequency": "FLOAT",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "KEYWORD_AD_STAT": {
                "type": "CUSTOM_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "AdGroupId": "STRING",
                    "AdGroupName": "STRING",
                    "AdId": "STRING",
                    "Impressions": "INTEGER",
                    "Clicks": "INTEGER",
                    "Cost": "FLOAT",
                    "CriterionId": "STRING",
                    "Criterion": "STRING",
                    "CriteriaType": "STRING"
                }
            },
            "KEYWORD_SOCDEM_STAT": {
                "type": "CUSTOM_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "AdGroupId": "STRING",
                    "AdGroupName": "STRING",
                    "AdId": "STRING",
                    "CriterionId": "STRING",
                    "Criterion": "STRING",
                    "CriteriaType": "STRING",
                    "Slot": "STRING",
                    "Age": "STRING",
                    "Gender": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER"
                }
            },
            "KEYWORD_DEVICE_STAT": {
                "type": "CRITERIA_PERFORMANCE_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "Device": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER",
                    "CriterionId": "STRING",
                    "Criterion": "STRING",
                    "CriteriaType": "STRING"
                }
            },
            "KEYWORD_DEVICE_AD_STAT": {
                "type": "CUSTOM_REPORT",
                "fields": {
                    "Date": "STRING",
                    "CampaignId": "STRING",
                    "CampaignName": "STRING",
                    "CampaignType": "STRING",
                    "AdGroupId": "STRING",
                    "AdGroupName": "STRING",
                    "AdId": "STRING",
                    "Impressions": "INTEGER",
                    "Cost": "FLOAT",
                    "Clicks": "INTEGER",
                    "CriterionId": "STRING",
                    "Criterion": "STRING",
                    "CriterionType": "STRING",
                    "AdNetworkType": "STRING",
                    "Device": "STRING",
                    "Slot": "STRING",
                    "Placement": "STRING",
                    "TargetingLocationId": "STRING",
                    "TargetingLocationName": "STRING"
                }
            }
        }

        self.tables_with_schema, self.string_fields, self.integer_fields, self.float_fields = \
            create_fields(client_name, "YandexDirect", self.report_dict)