facebook-python-business-sdk icon indicating copy to clipboard operation
facebook-python-business-sdk copied to clipboard

batch remote-create error because of id=None

Open linpingta opened this issue 11 years ago • 3 comments

Hi guys,

Thanks a lot for making this, but I meet one error when do batch remote_create of campaign/adset/ads and I am not sure whether it's a mistake.

My code like:

api_batch = api.new_batch()

 // def callback function

campaign.update({
    AdCampaign.Field.name: 'Seattle Ad Campaign',
    AdCampaign.Field.objective: AdCampaign.Objective.website_clicks,
    AdCampaign.Field.status: AdCampaign.Status.paused,
})

campaign.remote_create(batch=api_batch,success=callback_success,failure=callback_failure)

api.execute()

And it raises error like:

Traceback (most recent call last):
  File "create_ad.py", line 164, in <module>
   campaign.remote_create(batch=api_batch,success=callback_success,failure=callback_failure)
  File "/home/chutong/fb_api_test/facebookads/objects.py", line 529, in remote_create
    failure=callback_failure,
  File "/home/chutong/fb_api_test/facebookads/api.py", line 373, in add
    keyvals.append("%s=%s" % (key, urllib.parse.quote(params[key])))
  File "/usr/local/lib/python2.7/urllib.py", line 1225, in quote
    raise TypeError('None object cannot be quoted')
  TypeError: None object cannot be quoted

The reason is in

    for key in params:
            keyvals.append("%s=%s" % (key, urllib.parse.quote(params[key])))

params contains key='id' which has value None, it couldn't be treated as string here.

Should a judgement for value added here or do I make a wrong usage of batch remote create here?

Thanks for your help.

linpingta avatar Mar 07 '15 03:03 linpingta

duplicate of #30, but I think it's an actual bug

m-vdb avatar May 13 '15 20:05 m-vdb

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

ghost avatar Aug 04 '15 18:08 ghost

Closing this out. WIll track with #30

rituparnamukherjee avatar Apr 05 '16 18:04 rituparnamukherjee