コード例 #1
0
def get_leadgen_form(page_id=None):
    if page_id is None:
        page_id = test_config.page_id
    page = Page(page_id)
    forms = page.get_leadgen_forms()
    for i in forms:
        return i
    raise Exception(
        "Leadgen forms can't be created through the API."
        " The Page " + str(page_id) + " have no leadgen forms",
    )
コード例 #2
0
def get_lead(page_id=None, limit=25):
    if page_id is None:
        page_id = test_config.page_id
    page = Page(page_id)
    forms = page.get_leadgen_forms(
        fields=[LeadgenForm.Field.id],
        params={limit: limit},
    )
    for i in forms:
        leads = i.get_leads()
        for j in leads:
            return j
    raise Exception(
        "Leads forms can't be created through the API."
        " The first " + str(limit) +
        " leadgen forms of Page " + str(page_id) + " have no leads",
    )
コード例 #3
0
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.

# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# shall be included in all copies or substantial portions of the software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from facebookads import test_config

page_id = test_config.page_id

# _DOC oncall [pruno]
# _DOC open [PAGE_GET_LEADGENFORMS]
# _DOC vars [page_id]
from facebookads.objects import Page

page = Page(page_id)
leadgen_forms = page.get_leadgen_forms()
# _DOC close [PAGE_GET_LEADGENFORMS]