Skip to main content

Unofficial Facebook Graph API Handler

Project description

python-graph-handler

FBGraphHandler

FBGraphHandler is a Python library that simplifies the process of interacting with Facebook's Graph API. It provides methods for authenticating users, retrieving user details, posting text and video feeds, and more.

Installation

You can install FBGraphHandler using pip:

pip install FBGraphHandler

Usage

Importing FBGraphHandler

from FBGraphHandler import FBGraphHandler

Initializing FBGraphHandler

# Create an instance of FBGraphHandler
graph_handler = FBGraphHandler()

# Configure FBGraphHandler with your Facebook App credentials
graph_handler.Config(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", version="14.0")

Generating an Authorization URL

# Generate an authorization URL for users to complete the authentication process
auth_url = graph_handler.GenerateAuthURL(redirect_uri="YOUR_REDIRECT_URI", scopes=["public_profile", "email"])

Exchanging Authorization Code for Access Token

# Exchange the authorization code for an access token
access_token = graph_handler.ExchangeCodewithToken(code="AUTHORIZATION_CODE")

Getting User Details

# Get user details using the access token
user_details = graph_handler.GetUserDetails(access_token="ACCESS_TOKEN")

Posting a Text Feed

# Post a text feed to a user or page
post_id = graph_handler.PostTextFeed(text="Hello, Facebook!", id="PAGE_OR_USER_ID", access_token="ACCESS_TOKEN")

Posting a Video Feed

# Post a video feed to a user or page
post_id = graph_handler.PostVideoFeed(text="Check out this video!", id="PAGE_OR_USER_ID", access_token="ACCESS_TOKEN", video_url="VIDEO_URL")

Posting Media (Text, Photos, or Videos)

# Post text, photos, or videos to a user or page
media_urls = ["PHOTO_URL_1", "PHOTO_URL_2"]
post_id = graph_handler.PostToFacebook(text="My Facebook post", media_urls=media_urls, access_token="ACCESS_TOKEN", id="PAGE_OR_USER_ID", isVideo=False)

Documentation

For detailed documentation and more information about available methods and parameters, please refer to the official documentation.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GraphHandler-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GraphHandler-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file GraphHandler-0.1.1.tar.gz.

File metadata

  • Download URL: GraphHandler-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.2

File hashes

Hashes for GraphHandler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9841196e249f33149e51095423b7f65eea131068c210ead404c8657f1d093380
MD5 79cbb7d77d3126ee8d8a9e8794603b25
BLAKE2b-256 d048750a0da77ee5bed77bd518ffec9a3988463371b1696932cab6a7beba992f

See more details on using hashes here.

File details

Details for the file GraphHandler-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: GraphHandler-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.2

File hashes

Hashes for GraphHandler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81648262c39fef07d93ba00b482acb5fd4f936ed80a896e18255c4af0697ecfd
MD5 0ac7e99eacd0ff459bc0a164ab882601
BLAKE2b-256 dd61788887b7831bd64ca73735180c80ca63930027256f0c2727ccb9989f0948

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page