A lightweight Python wrapper for Facebook APIs
Project description
PythonFacebook
A lightweight Python library for interacting with the Facebook Graph API to manage page content.
Installation
pip install python-facebook-lite
Features
- Post text messages to Facebook pages
- Upload images with captions
- Upload videos
- Post comments on existing posts
- Robust error handling
Quick Start
from pythonfacebook.facebook import Facebook
# Initialize with your Page ID and Access Token
fb = Facebook(page_id="your_page_id", access_token="your_access_token")
# Post a text message
fb.create_text_post("Hello, world!")
# Post an image
fb.create_image_post(
post_text="Check out this image!",
image_paths=["/path/to/image.jpg"]
)
# Post a video
fb.create_video_post(
video_path="/path/to/video.mp4",
title="My Video",
description="Video description"
)
# Post a comment
fb.create_comment(post_id="facebook_post_id", comment="Nice post!")
Authentication
You'll need:
- A Facebook Page ID
- A valid Access Token with appropriate permissions
Methods
create_text_post(text, url=None): Post text to your pagecreate_image_post(post_text, image_paths): Post images with textcreate_video_post(video_path, title=None, description=None): Upload a videocreate_comment(post_id, comment): Comment on a post
Error Handling
Methods return None if a request fails and log errors.
Requirements
- Python 3.10+
requestslibrary
Contributing
Contributions welcome! Submit pull requests or open issues.
License
MIT License
Disclaimer
Not officially affiliated with Facebook. Use according to Facebook's API terms of service.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-facebook-lite-0.1.1.tar.gz.
File metadata
- Download URL: python-facebook-lite-0.1.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
779cb27c71d0b1fdcf304b9fa642c20b46ee0ec603df022b1a4128f385fa87d3
|
|
| MD5 |
b491a250969807aead63f4eaa3d7b8b4
|
|
| BLAKE2b-256 |
c1eec47dd59dd76bd91945137500832ee0ec1647f7dc5d3ae3752fd326084dce
|
File details
Details for the file python_facebook_lite-0.1.1-py3-none-any.whl.
File metadata
- Download URL: python_facebook_lite-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30584008213dfd4a05c6254cc3fb2f91575b55e3d89fa039d8c91a7c899ab25d
|
|
| MD5 |
572fec82ae9e829469aab547a58291e6
|
|
| BLAKE2b-256 |
874dab61673fbeda1ab74926cfc8d75d375cb4daff3be7849bf8f363fd4d2ea9
|