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

EdgeIterator._total_count is not always set and can be VERY misleading

Open m-vdb opened this issue 11 years ago • 8 comments

see those lines https://github.com/facebook/facebook-python-ads-sdk/blob/master/facebookads/objects.py#L146-L147. We expected it to be set every time, and we used the total() method that returns None, which is really bad because it silently tells that there is no stats. Instead:

  • could we make sure we retrieve the total_count in every situation?
  • if not possible, can we raise an Exception so that we do not fail silently?

I can come up with a PR if you want

m-vdb avatar Apr 22 '15 18:04 m-vdb

cc @ebzlo

m-vdb avatar Apr 22 '15 18:04 m-vdb

@m-vdb could you submit a PR? I can get to it, but probably not until next week. I think throwing an exception when calling total() when _total_count is not set is the best solution here. Some endpoints don't return the value.

ebzlo avatar Apr 22 '15 20:04 ebzlo

thanks, PR done, let me know if it works for you.

m-vdb avatar Apr 22 '15 20:04 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

@rituparnamukherjee I believe you want to merge that => https://github.com/facebook/facebook-python-ads-sdk/pull/53

m-vdb avatar Apr 13 '16 17:04 m-vdb

@m-vdb : Can you rebase it off the latest. If not then I can get to this in a few days time.

rituparnamukherjee avatar Apr 13 '16 17:04 rituparnamukherjee

@rituparnamukherjee actually, looks like you rebased #53 on your side and merged it => https://github.com/facebook/facebook-python-ads-sdk/blob/master/facebookads/api.py#L759-L765. You can close #53 I guess...

m-vdb avatar Apr 13 '16 18:04 m-vdb

Sounds good ! We have done some major clean ups so might have included this one in. Thanks @m-vdb

rituparnamukherjee avatar Apr 13 '16 18:04 rituparnamukherjee