def step_impl(context):
    endpoint = "{}{}{}{}{}{}{}".format(apiResources.getids,
                                       payload.getClientID(),
                                       apiResources.getAdaccount,
                                       payload.getAdaccountID(),
                                       apiResources.experimentSetup,
                                       payload.getExperimentSetupID(),
                                       apiResources.publish)
    context.url = getConfig()['API']['endpoint'] + endpoint
    context.Authorization = {'Authorization': payload.getToken()}
def step_impl(context):
    endpoint = "{}{}{}".format(apiResources.getExpSetup,
                               payload.getExperimentSetupID(),
                               apiResources.getStoryName)
    context.url = getConfig()['API']['endpoint'] + endpoint
    context.Authorization = {'Authorization': payload.getToken()}
Exemple #3
0
def getPublishBodyLeadgen():
    name = payload.getCampaignName()
    expID = str(payload.getExperimentSetupID())
    age_max = payload.getAgeMax()
    age_min = payload.getAgeMin()
    daily_budget = getDailyBudget()
    return {
        "creative_ids": [1046],
        "story_id":
        payload.getStoryID(),
        "json": [{
            "campaign": {
                "name":
                "aipsm_TEST_FBIN_O:LN_Base:Multi_*AQ-E:M:T:-TEST-A-BRD--0421-    "
                + expID + "*_AUTOMATION_" + name + "_" + expID + "",
                "status":
                "PAUSED",
                "objective":
                "APP Install",
                "buying_type":
                "AUCTION",
                "bid_strategy":
                "Lowest Cost",
                "daily_budget":
                daily_budget,
                "campaign_budget":
                "DAILY_BUDGET"
            },
            "ads_groups": [{
                "ad": {
                    "name":
                    "aipsm_TEST_FBIN_O:LN_Base:Multi_22to33_ALL_MP_##AQ-FBIN-TEST-SI-270421-476|cr_bmp##__AUTOMATION_"
                    + expID + "",
                    "status":
                    "ACTIVE",
                    "tracking_specs": {
                        "fb_pixel": "706589963501348"
                    }
                },
                "adset": {
                    "name":
                    "aipsm_TEST_FBIN_O:LN_Base:Multi_22to33_ALL_MP__AUTOMATION_"
                    + name + "_" + expID + "",
                    "status":
                    "ACTIVE",
                    "billing_event":
                    "IMPRESSIONS",
                    "promoted_object":
                    "App Install",
                    "adset_time_start":
                    "2021-04-27T20:16:59+05:30",
                    "attribution_spec": [{
                        "event_type": "CLICK_THROUGH",
                        "window_days": 1
                    }],
                    "optimization_goal":
                    "App Install"
                },
                "ad_type": "image",
                "creative": {
                    "creative_type": "Link Page Post Ad",
                    "object_type": "SHARE"
                },
                "targeting": {
                    "age_max":
                    age_max,
                    "age_min":
                    age_min,
                    "custom_audiences": [{
                        "id": "23847574287240410",
                        "name":
                        "Lookalike (IN, 1% to 5%) - Ranit's testing audience",
                        "subtype": "LOOKALIKE"
                    }, {
                        "id":
                        "23847574322950410",
                        "name":
                        "Special Ad Audience (IN, 2%) - Ranit's testing audience",
                        "subtype":
                        "REGULATED_CATEGORIES_AUDIENCE"
                    }],
                    "targeting_optimization":
                    "none",
                    "excluded_custom_audiences": [{
                        "id":
                        "23847574323680410",
                        "name":
                        "Special Ad Audience (IN, 4% to 7%) - Ranit's testing audience",
                        "subtype":
                        "REGULATED_CATEGORIES_AUDIENCE"
                    }, {
                        "id": "23847574286990410",
                        "name":
                        "Lookalike (IN, 1%) - Ranit's testing audience",
                        "subtype": "LOOKALIKE"
                    }],
                    "brand_safety_content_filter_levels":
                    ["FACEBOOK_STANDARD", "AN_STANDARD"]
                },
                "story_spec": {
                    "page_id": "245069182739198"
                },
                "geo_locations": {
                    "countries": [],
                    "cities": [{
                        "country": "IN",
                        "name": "Varanasi",
                        "region": "Uttar Pradesh",
                        "key": "1046744"
                    }],
                    "regions": [{
                        "name": "Karnataka",
                        "country": "IN",
                        "key": "1738"
                    }],
                    "zips": [],
                    "country_groups": [],
                    "location_types": ["home", "recent"]
                },
                "excluded_geo_locations": {
                    "countries": [],
                    "cities": [],
                    "regions": [],
                    "zips": [],
                    "country_groups": [],
                    "location_types": ["home"]
                },
                "photo_data_spec": {
                    "call_to_action": {
                        "type": "LEARN_MORE",
                        "value": {
                            "lead_gen_form_id": "254429285840340"
                        }
                    },
                    "image_name": "1617808700111_img-ui-cdgsx.bmp",
                    "link": "https://fb.me/",
                    "message": "123",
                    "name": "12"
                }
            }]
        }],
        "creative_s3_url":
        "https://s3.console.aws.amazon.com/s3/buckets/fb-adsuploading-files-bucket/dev-upload-form/client-122/creative/",
        "campaignDetails": {
            "1046": [{
                "name":
                "aipsm_TEST_FBIN_O:LN_Base:Multi_*AQ-E:M:T:-TEST-A-BRD--0421-    "
                + expID + "*_AUTOMATION_" + name + "_" + expID + "",
                "adsets": [{
                    "adset_name":
                    "aipsm_TEST_FBIN_O:LN_Base:Multi_22to33_ALL_MP__AUTOMATION_"
                    + name + "_" + expID + "",
                    "ads": [{
                        "ad_name":
                        "aipsm_TEST_FBIN_O:LN_Base:Multi_22to33_ALL_MP_##AQ-FBIN-TEST-SI-270421-476|cr_bmp##__AUTOMATION_"
                        + expID + ""
                    }]
                }]
            }]
        }
    }
def step_impl(context):
    payload.saveExperimentSetupID(context.experiment_setup_json['data']['id'])
    log.debug("Experiment setup id is: " +
              str(payload.getExperimentSetupID()) + "\n\n")
Exemple #5
0
def step_impl(context):
    payload.saveExperimentSetupID(context.experiment_setup_json['data']['id'])
    print(payload.getExperimentSetupID())