facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.32k stars 643 forks source link

(#17) User request limit reached internally from cursor pagination #446

Closed vishalgarale closed 6 years ago

vishalgarale commented 6 years ago

We are trying to fetch "ad" level reports from SDK sample codes are below

access_token = 'XYZ'
ad_account_id = "act_121212"
app_id = '234234234'
FacebookAdsApi.init(access_token=access_token)
fields = [
    "impressions", "account_name", "campaign_name", "spend"
]
params = {
    'level': 'ad',
    'filtering': [],
    'breakdowns': ['hourly_stats_aggregated_by_audience_time_zone'],
    'time_increment': 1,  
    'time_range': {'since': '2018-02-10', 'until':'2018-02-12'},
    'action_attribution_windows': ['28d_view', '1d_click']
}
data = AdAccount(ad_account_id).get_insights(
    fields=fields,
    params=params
)
results = []
while not data._finished_iteration:
    tmp_data = copy.deepcopy(data)
    results.append([dict(i) for i in tmp_data])
    data.load_next_page()

During iterating over cursor, we are reaching Rate limit, which was internal pagination, how we can able to get full data, because number of rows are high so every time it will reach to Rate limit. Is any way to do manual pagination?

codytwinton commented 6 years ago

Hi, it seems like this issue has been open for more than a few months now. We have made many changes in the SDK since then, including releasing a new version. If you can repro your specific issue with the latest version of the SDK, please create a new issue or comment here with further details.