Skip to main content

Unified social media publishing library

Project description

SocialPost

A unified, provider-agnostic Python library for publishing content across multiple social media platforms. Built with enterprise-grade architecture: clean abstractions, dependency injection, comprehensive error handling, and extensive testability.

Features

  • Multi-platform support - TikTok, Reddit, Instagram, Facebook, YouTube
  • Async-first - All network I/O is async, with concurrent publishing support
  • Strongly typed - Complete type hints, frozen dataclasses, Protocol-based interfaces
  • Fail-safe by default - Railway-oriented programming with Result[T] types, no surprise exceptions
  • Dependency injection - Pluggable HTTP clients, authenticators, and rate limiters
  • Extensible - Protocol-based design makes adding new platforms straightforward

Installation

pip install socialpost

# With all platform dependencies
pip install socialpost[all]

# Specific platforms
pip install socialpost[reddit,tiktok]

Quick Start

import asyncio
from socialpost import SocialPost, Post, Media, MediaType, ContentFormat

async def main():
    async with SocialPost() as sp:
        # Configure your platform (see docs/auth_setup.md for credentials)
        # await sp.add_platform("reddit", reddit_auth, reddit_publisher)

        # Create a post
        post = Post(
            text="Check out this library!",
            tags=["python", "automation"],
            metadata={"subreddit": "programming"},
        )

        # Publish
        # result = await sp.publish("reddit", post)
        # if result.is_ok:
        #     print(f"Published! ID: {result.unwrap()}")
        # else:
        #     error = result.unwrap_err()
        #     print(f"Failed: {error.message}")

asyncio.run(main())

Multi-Platform Publishing

# Publish to all configured platforms
results = await sp.publish_to_all(post, platforms=["reddit", "tiktok"])

for platform, result in results.items():
    if result.is_ok:
        print(f"{platform}: {result.unwrap()}")
    else:
        print(f"{platform}: {result.unwrap_err().message}")

Documentation

Supported Platforms

Platform Text Images Video Stories Polls Threads
Reddit Yes Yes Yes No Yes Yes
TikTok No No Yes No No No
Instagram No Yes Yes Yes No No
Facebook Yes Yes Yes Yes No No
YouTube No No Yes No No No

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=socialpost

# Type checking
mypy socialpost

# Format code
black socialpost
ruff check socialpost

Contributing

Contributions are welcome! See CONTEXT.md for architectural guidelines and code style.

License

MIT

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

socialpost-0.1.0.tar.gz (77.7 kB view details)

Uploaded Source

Built Distribution

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

socialpost-0.1.0-py3-none-any.whl (95.6 kB view details)

Uploaded Python 3

File details

Details for the file socialpost-0.1.0.tar.gz.

File metadata

  • Download URL: socialpost-0.1.0.tar.gz
  • Upload date:
  • Size: 77.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for socialpost-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11c19fee493fe45ab86a80779baf443c27d851e5dccb6ab0a8bc64697b40b4ad
MD5 c1cc3355fad85a81820ffa83b7444fda
BLAKE2b-256 eed743775efc42559de73e466f4cbbe42ce225e81dd1ff15eab0ae3f4c4329b2

See more details on using hashes here.

File details

Details for the file socialpost-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: socialpost-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 95.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for socialpost-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef9ff8da92010d301b26dbd2a7ed89a148c9a064857e6cbc0729df407b0d615f
MD5 0b3962ef9753d75b1b6543396f589e7f
BLAKE2b-256 f450fa6a6c06c874a92844409aa5e4ebb8815eee4c580ae9d8819544c6964d45

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