Skip to content

Commit

Permalink
Fix Cursor Paging Issue on Duplicating Fields
Browse files Browse the repository at this point in the history
Summary:
[BizSDK][Python] Fix Cursor Paging Issue on Duplicating Fields

#641

We have seen access_token and summary fields being duplicated during multiple API calls using the Cursor on paging. A newly placed (?) restriction on the size of the request surfaced this issue up because the requests getting larger and larger when calling load_next_page() function again and again.

To check the details of this bug, please refer to the issue reported by the community.

After the fix, the version will also be bumped to 17.0.2.

Reviewed By: mengxuanzhangz

Differential Revision: D46949894

fbshipit-source-id: 2fdbb49f309b4f7709a4bdccdf9e80e53355268a
  • Loading branch information
stcheng authored and facebook-github-bot committed Jun 23, 2023
1 parent f69504b commit 4ce6acc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion facebook_business/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from facebook_business.session import FacebookSession
from facebook_business.api import FacebookAdsApi

__version__ = '17.0.1'
__version__ = '17.0.2'
__all__ = [
'session',
'objects',
Expand Down
9 changes: 6 additions & 3 deletions facebook_business/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,12 @@ def load_next_page(self):
response = response_obj.json()
self._headers = response_obj.headers()

if 'paging' in response and 'next' in response['paging']:
self._path = response['paging']['next']
self.params = {}
if (
'paging' in response and
'cursors' in response['paging'] and
'after' in response['paging']['cursors']
):
self.params['after'] = response['paging']['cursors']['after']
else:
# Indicate if this was the last page
self._finished_iteration = True
Expand Down
2 changes: 1 addition & 1 deletion facebook_business/apiconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

ads_api_config = {
'API_VERSION': 'v17.0',
'SDK_VERSION': 'v17.0.1',
'SDK_VERSION': 'v17.0.2',
'STRICT_MODE': False
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
requirements_filename = os.path.join(this_dir, 'requirements.txt')

PACKAGE_NAME = 'facebook_business'
PACKAGE_VERSION = '17.0.1'
PACKAGE_VERSION = '17.0.2'
PACKAGE_AUTHOR = 'Facebook'
PACKAGE_AUTHOR_EMAIL = ''
PACKAGE_URL = 'https://github.com/facebook/facebook-python-business-sdk'
Expand Down

0 comments on commit 4ce6acc

Please sign in to comment.