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

abstractobject._set_data saves the data both to _json and to _data instance variables #428

Closed Odelya closed 6 years ago

Odelya commented 6 years ago

I see that the SDK populates both _json and _data instance variables with the same information. Why would it do it?

    def _set_data(self, data):
        if hasattr(data, 'items'):
            for key, value in data.items():
                self[key] = value
        else:
            raise FacebookBadObjectError("Bad data to set object data")
        self._json = data

I suggest to hold the json only in one instance variable and retrieving from it when one asks for one key.

codytwinton commented 6 years ago

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.