My first PyPI package: python-facebook-lite

I’m excited to share my first open source project, python-facebook-lite, a Python library that simplifies interaction with the Facebook Graph API for page content management. It’s a cool moment for me and a step forward into the open source community.

Why I created it

I often struggled with the complexity of Facebook’s API when trying to automate posts for various pages. While several libraries exist, I needed something extreeemely light, available via pip install, to do just this on a Facebook page:

  • Post text messages
  • Upload images with captions
  • Upload videos with descriptions
  • Add comments to existing posts

That’s it! These are the only actions I take 99.9% of the time on all the pages I have.

This is a simple library that does exactly what it needs to, without unnecessary complexity.

Install it:

pip install python-facebook-lite

Use it:

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!")

I intend to add support for more Facebook API features and improve the documentation based on community feedback.

Leave a Comment