From 7a0d2d93086279ddfb69af4c5413c23c18712cea Mon Sep 17 00:00:00 2001 From: Rituparna Mukherjee Date: Sun, 20 Sep 2015 15:10:01 -0700 Subject: [PATCH] Adding SDK support for minimum budgets endpoint Summary: New endpoint minimum_budgets was intoroduced. Added SDK support for the same Test Plan: All tests pass: ritu-mbp:python-ads-sdk ritu$ python -m facebookads.test.unit ............................ ---------------------------------------------------------------------- Ran 28 tests in 0.014s OK Sample run output: ritu-mbp:python-ads-sdk ritu$ python -i facebookads/bootstrap.py >>> a = AdAccount('act_11124366') >>> print a.get_minimum_budgets { "id": "act_11124366" }> >>> print a.get_minimum_budgets() [ { "currency": "USD", "min_daily_budget_high_freq": 500, "min_daily_budget_imp": 100, "min_daily_budget_low_freq": 4000 }, { "currency": "CAD", "min_daily_budget_high_freq": 670, "min_daily_budget_imp": 134, "min_daily_budget_low_freq": 5359 }, { "currency": "EUR", "min_daily_budget_high_freq": 450, "min_daily_budget_imp": 90, "min_daily_budget_low_freq": 3603 }, { "currency": "GBP", "min_daily_budget_high_freq": 329, "min_daily_budget_imp": 66, "min_daily_budget_low_freq": 2636 }, { "currency": "AUD", "min_daily_budget_high_freq": 709, "min_daily_budget_imp": 142, "min_daily_budget_low_freq": 5674 }, { "currency": "JPY", "min_daily_budget_high_freq": 610, "min_daily_budget_imp": 122, "min_daily_budget_low_freq": 4879 }, { "currency": "TRY", "min_daily_budget_high_freq": 766, "min_daily_budget_imp": 153, "min_daily_budget_low_freq": 6131 }, { "currency": "VEF", "min_daily_budget_high_freq": 3409, "min_daily_budget_imp": 682, "min_daily_budget_low_freq": 27273 }, { "currency": "COP", "min_daily_budget_high_freq": 7642, "min_daily_budget_imp": 1528, "min_daily_budget_low_freq": 61133 }, { "currency": "NOK", "min_daily_budget_high_freq": 4165, "min_daily_budget_imp": 833, "min_daily_budget_low_freq": 33319 }, { "currency": "SEK", "min_daily_budget_high_freq": 4201, "min_daily_budget_imp": 840, "min_daily_budget_low_freq": 33605 }, { "currency": "DKK", "min_daily_budget_high_freq": 3360, "min_daily_budget_imp": 672, "min_daily_budget_low_freq": 26882 }, { "currency": "CLP", "min_daily_budget_high_freq": 1715, "min_daily_budget_imp": 343, "min_daily_budget_low_freq": 13722 }, { "currency": "HKD", "min_daily_budget_high_freq": 3915, "min_daily_budget_imp": 783, "min_daily_budget_low_freq": 31318 }, { "currency": "CHF", "min_daily_budget_high_freq": 493, "min_daily_budget_imp": 99, "min_daily_budget_low_freq": 3946 }, { "currency": "NZD", "min_daily_budget_high_freq": 798, "min_daily_budget_imp": 160, "min_daily_budget_low_freq": 6382 }, { "currency": "MXN", "min_daily_budget_high_freq": 4235, "min_daily_budget_imp": 847, "min_daily_budget_low_freq": 33882 }, { "currency": "ZAR", "min_daily_budget_high_freq": 3411, "min_daily_budget_imp": 682, "min_daily_budget_low_freq": 27285 }, { "currency": "ILS", "min_daily_budget_high_freq": 1955, "min_daily_budget_imp": 391, "min_daily_budget_low_freq": 15640 }, { "currency": "ARS", "min_daily_budget_high_freq": 2373, "min_daily_budget_imp": 475, "min_daily_budget_low_freq": 18985 }, { "currency": "BOB", "min_daily_budget_high_freq": 1758, "min_daily_budget_imp": 352, "min_daily_budget_low_freq": 14061 }, { "currency": "BRL", "min_daily_budget_high_freq": 969, "min_daily_budget_imp": 194, "min_daily_budget_low_freq": 7751 }, { "currency": "CNY", "min_daily_budget_high_freq": 1609, "min_daily_budget_imp": 322, "min_daily_budget_low_freq": 12876 }, { "currency": "CRC", "min_daily_budget_high_freq": 1364, "min_daily_budget_imp": 273, "min_daily_budget_low_freq": 10909 }, { "currency": "CZK", "min_daily_budget_high_freq": 6101, "min_daily_budget_imp": 1220, "min_daily_budget_low_freq": 48807 }, { "currency": "GTQ", "min_daily_budget_high_freq": 1940, "min_daily_budget_imp": 388, "min_daily_budget_low_freq": 15521 }, { "currency": "HNL", "min_daily_budget_high_freq": 5492, "min_daily_budget_imp": 1098, "min_daily_budget_low_freq": 43939 }, { "currency": "HUF", "min_daily_budget_high_freq": 697, "min_daily_budget_imp": 139, "min_daily_budget_low_freq": 5577 }, { "currency": "ISK", "min_daily_budget_high_freq": 323, "min_daily_budget_imp": 65, "min_daily_budget_low_freq": 2583 }, { "currency": "INR", "min_daily_budget_high_freq": 16799, "min_daily_budget_imp": 3360, "min_daily_budget_low_freq": 134391 }, { "currency": "MOP", "min_daily_budget_high_freq": 2018, "min_daily_budget_imp": 404, "min_daily_budget_low_freq": 16144 }, { "currency": "MYR", "min_daily_budget_high_freq": 1089, "min_daily_budget_imp": 218, "min_daily_budget_low_freq": 8713 }, { "currency": "NIO", "min_daily_budget_high_freq": 6953, "min_daily_budget_imp": 1391, "min_daily_budget_low_freq": 55627 }, { "currency": "PYG", "min_daily_budget_high_freq": 14114, "min_daily_budget_imp": 2823, "min_daily_budget_low_freq": 112909 }, { "currency": "PEN", "min_daily_budget_high_freq": 811, "min_daily_budget_imp": 162, "min_daily_budget_low_freq": 6489 }, { "currency": "PLN", "min_daily_budget_high_freq": 948, "min_daily_budget_imp": 190, "min_daily_budget_low_freq": 7580 }, { "currency": "PHP", "min_daily_budget_high_freq": 11746, "min_daily_budget_imp": 2349, "min_daily_budget_low_freq": 93970 }, { "currency": "QAR", "min_daily_budget_high_freq": 920, "min_daily_budget_imp": 184, "min_daily_budget_low_freq": 7358 }, { "currency": "RON", "min_daily_budget_high_freq": 988, "min_daily_budget_imp": 198, "min_daily_budget_low_freq": 7903 }, { "currency": "RUB", "min_daily_budget_high_freq": 16722, "min_daily_budget_imp": 3344, "min_daily_budget_low_freq": 133776 }, { "currency": "SAR", "min_daily_budget_high_freq": 948, "min_daily_budget_imp": 190, "min_daily_budget_low_freq": 7580 }, { "currency": "SGD", "min_daily_budget_high_freq": 709, "min_daily_budget_imp": 142, "min_daily_budget_low_freq": 5672 }, { "currency": "KRW", "min_daily_budget_high_freq": 5917, "min_daily_budget_imp": 1183, "min_daily_budget_low_freq": 47337 }, { "currency": "TWD", "min_daily_budget_high_freq": 164, "min_daily_budget_imp": 33, "min_daily_budget_low_freq": 1311 }, { "currency": "THB", "min_daily_budget_high_freq": 9075, "min_daily_budget_imp": 1815, "min_daily_budget_low_freq": 72599 }, { "currency": "AED", "min_daily_budget_high_freq": 928, "min_daily_budget_imp": 186, "min_daily_budget_low_freq": 7420 }, { "currency": "UYU", "min_daily_budget_high_freq": 7271, "min_daily_budget_imp": 1454, "min_daily_budget_low_freq": 58168 }, { "currency": "VND", "min_daily_budget_high_freq": 56810, "min_daily_budget_imp": 11362, "min_daily_budget_low_freq": 454483 }, { "currency": "IDR", "min_daily_budget_high_freq": 36522, "min_daily_budget_imp": 7304, "min_daily_budget_low_freq": 292180 }] --- facebookads/objects.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/facebookads/objects.py b/facebookads/objects.py index 8fabb23f..7363eb02 100644 --- a/facebookads/objects.py +++ b/facebookads/objects.py @@ -1193,6 +1193,13 @@ def get_ad_campaign_groups_by_labels(self, fields=None, params=None): """ return self.iterate_edge(AdCampaignGroupsByLabels, fields, params) + def get_minimum_budgets(self, fields=None, params=None): + """ + Returns the minimum budget associated with the AdAccount + """ + return self.iterate_edge(MinimumBudget, fields, params) + + class AdAccountGroup(AbstractCrudObject): class Field(object): @@ -2973,6 +2980,19 @@ def get_leads(self, fields=None, params=None): return self.iterate_edge(Lead, fields, params) +class MinimumBudget(AbstractObject): + + class Field(object): + currency = 'currency' + min_daily_budget_imp = 'min_daily_budget_imp' + min_daily_budget_high_freq = 'min_daily_budget_high_freq' + min_daily_budget_low_freq = 'min_daily_budget_low_freq' + + @classmethod + def get_endpoint(cls): + return 'minimum_budgets' + + class AsyncJob(CannotCreate, AbstractCrudObject): class Field(object):