facebook / facebook-python-business-sdk

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

Fix normalize_key to return appuid properly #547

Closed jacobhjkim closed 5 years ago

jacobhjkim commented 5 years ago
                    for key in user:
                        key = key.strip(" \t\r\n\0\x0B.").lower()
                        key = cls.normalize_key(schema[counter],
                                                           str(key))
                        if schema[counter] != \
                                cls.Schema.MultiKeySchema.extern_id:
                            if isinstance(key, six.text_type):
                                key = key.encode('utf8')
                            key = hashlib.sha256(key).hexdigest()

In format_params, when a key's schema is Schema.MultiKeySchema.appuid, it will enter normalize_key function and return None. Thus, causing an error when you are trying to hash. Therefore, I propose to change the normalize_key function to return key_value when key's schema is Schema.MultiKeySchema.appuid

facebook-github-bot commented 5 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 5 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

jacobhjkim commented 5 years ago

Bug report related to this issue. https://developers.facebook.com/support/bugs/704470210011752/

jingping2015 commented 5 years ago

Code already merge to GitHub, next release this will be get fixed. Thanks for helping fix this issue.