Skip to main content

Facebook SDK Python

https://travis-ci.org/zetahernandez/facebook-python-sdk.svg?branch=master https://coveralls.io/repos/github/zetahernandez/facebook-python-sdk/badge.svg

Facebook SDK Python is a python based implementation of Facebook PHP SDK

Installation

To install Facebook SDK Python, simply:

$ pip install facebook-sdk-python

Usage

Retrieve User Profile

from facebook_sdk.exceptions import FacebookResponseException
from facebook_sdk.facebook import Facebook

facebook = Facebook(
    app_id='{app_id}',
    app_secret='{app_secret}',
    default_graph_version='v2.5',
)

facebook.set_default_access_token(access_token='{access_token}')

try:
    response = facebook.get(endpoint='/me?fields=id,name')
except FacebookResponseException as e:
    print e.message
else:
    print 'User name: %(name)s' % {'name': response.json_body.get('id')}

Batch Upload Files

from facebook_sdk.exceptions import FacebookResponseException
from facebook_sdk.facebook import Facebook

facebook = Facebook(
    app_id='{app_id}',
    app_secret='{app_secret}',
)

facebook.set_default_access_token(access_token='{access_token}')

batch = {
    'photo-one': facebook.request(
        endpoint='/me/photos',
        params={
            'message': 'Foo photo.',
            'source': facebook.file_to_upload('path/to/foo.jpg'),
        },
    ),
    'photo-two': facebook.request(
        endpoint='/me/photos',
        params={
            'message': 'Bar photo.',
            'source': facebook.file_to_upload('path/to/bar.jpg'),
        },
    ),
    'photo-three': facebook.request(
        endpoint='/me/photos',
        params={
            'message': 'Other photo.',
            'source': facebook.file_to_upload('path/to/other.jpg'),
        },
    )
}

try:
    responses = facebook.send_batch_request(requests=batch)
except FacebookResponseException as e:
    print e.message

Dependencies

Dependencies that to use the application:

Metadata

Release files for facebook-sdk-python 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for facebook-sdk-python 0.0.4
File Size Uploaded
facebook-sdk-python-0.0.4.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for facebook-sdk-python 0.0.4
File Interpreter ABI Platform
facebook_sdk_python-0.0.4-py2-none-any.whl Python 2 none any Details

Total release size: 23.2 kB

Release files / facebook-sdk-python-0.0.4.tar.gz

Download URL facebook-sdk-python-0.0.4.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bda0b7d64d206055ec7d5333159ce036625f49be5c70e4b9d6c56b74dde564fd
BLAKE2b-256 checksum
How to use checksums
cf8b7a806d564b200989632cab1b79b59a6a14adbcabe804bbe3326e90e307a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / facebook_sdk_python-0.0.4-py2-none-any.whl

Download URL facebook_sdk_python-0.0.4-py2-none-any.whl
Size 14.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
115be61575696321652258e0dfa2cd78070bc59af0e99e81bbd1961ed17ecd3e
BLAKE2b-256 checksum
How to use checksums
6b11ab952ead1586b2608ed1fb08dbc79da56f45d0ea2e9fbc7a7ec21517a24f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

3 release files

0.0.2

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page