facebookmarketing is an API wrapper for Facebook written in Python
pip install facebookmarketing-python
from facebookmarketing.client import Client
client = Client('APP_ID', 'APP_SECRET', 'v2.10')
Get authorization url
url = client.authorization_url('REDIRECT_URL', ['manage_pages'])
Exchange the code for an access token
token = client.exchange_code('REDIRECT_URL', 'CODE')
Extend a short-lived access token for a long-lived access token
token = client.extend_token('SHORT-LIVED TOKEN')
Get app token
token = client.get_app_token()
Inspect a token
info = client.inspect_token('INPUT TOKEN', 'APP TOKEN')
Set the access token
client.set_access_token('TOKEN')
Get account information
account = client.get_account()
Get account pages
pages = client.get_pages()
Get forms given the page
forms = client.get_ad_account_leadgen_forms('PAGE_ID')
Get leads given the form
leads = client.get_ad_leads('FORM_ID')
- requests
python tests/test_client.py
- Ad Creative
- Image Ad
- Previews
- Ad Preview Plugin
- Ad Set
- Ad User
- Ad Video
- Campaign
- Connection Objects
- Currencies
- Image Crop
- Product Catalog
We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.
You can report any bug you find or suggest new functionality with a new issue.
- Fork it ( https://github.com/GearPlug/facebookmarketing-python )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Adds my new feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request