Skip to main content

Official UniPost API client for Python

Project description

unipost

Official UniPost API client for Python. Post to 7 social platforms with one API call.

Installation

pip install unipost

For async support:

pip install unipost[async]

Quick Start

from unipost import UniPost

# Reads UNIPOST_API_KEY from environment automatically
client = UniPost()

post = client.posts.create(
    caption="Hello from UniPost! 🚀",
    account_ids=["sa_twitter_xxx", "sa_linkedin_xxx"],
)

Usage

List Accounts

result = client.accounts.list()
accounts = result["data"]

# Filter by platform
twitter = client.accounts.list(platform="twitter")

Create Posts

# Immediate publish
post = client.posts.create(
    caption="Hello world!",
    account_ids=["sa_twitter_xxx"],
)

# Scheduled
post = client.posts.create(
    caption="Scheduled post",
    account_ids=["sa_twitter_xxx"],
    scheduled_at="2026-04-28T09:00:00Z",
)

# Per-platform captions
post = client.posts.create(
    platform_posts=[
        {"account_id": "sa_twitter_xxx", "caption": "Short tweet 🐦"},
        {"account_id": "sa_linkedin_xxx", "caption": "Longer LinkedIn version..."},
    ]
)

# Save as draft
draft = client.posts.create(
    caption="Work in progress",
    account_ids=["sa_twitter_xxx"],
    status="draft",
)

Async

from unipost import AsyncUniPost

async def main():
    client = AsyncUniPost()
    post = await client.posts.create(
        caption="Async post!",
        account_ids=["sa_twitter_xxx"],
    )

Get Connect URL (Your Own Accounts)

connect = client.connect.get_connect_url(
    profile_id="pr_brand_us",
    platform="linkedin",
    redirect_url="https://app.acme.com/integrations/done",  # optional
)

print(connect.auth_url)

Webhook Verification

from unipost import verify_webhook_signature

is_valid = verify_webhook_signature(
    payload=request.body,
    signature=request.headers["X-UniPost-Signature"],
    secret=os.environ["UNIPOST_WEBHOOK_SECRET"],
)

Error Handling

from unipost import UniPost, AuthError, RateLimitError, UniPostError

try:
    post = client.posts.create(...)
except AuthError:
    print("API key invalid")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except UniPostError as e:
    print(f"API error: {e.status} {e.code} {e}")

Type Hints

Full type annotations included. Works with mypy.

from unipost import Post, SocialAccount

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

unipost-0.2.8.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

unipost-0.2.8-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file unipost-0.2.8.tar.gz.

File metadata

  • Download URL: unipost-0.2.8.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for unipost-0.2.8.tar.gz
Algorithm Hash digest
SHA256 8a4d89462eb4b84c440d75d85ec52d48930cd22c9fd3120348d583f813217fa6
MD5 b7ca850cb4b77a26685e8fa123664866
BLAKE2b-256 42a9d9ac5ed46f0bad935d0766b982483f9dccc46a88261bec0f568676ac399b

See more details on using hashes here.

Provenance

The following attestation bundles were made for unipost-0.2.8.tar.gz:

Publisher: publish.yml on unipost-dev/sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unipost-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: unipost-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for unipost-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bf3a648f552f161958f8bd09f44a0eefa3acada3e3d09ec9228396ccad4b0bdc
MD5 5ac9f3b25aa7fba953987c2314e1ddfa
BLAKE2b-256 cc5b0c96a70f72803dcfb9c11d7ccdfeaea52c7f3b1241b12f31f6491ec1d7a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for unipost-0.2.8-py3-none-any.whl:

Publisher: publish.yml on unipost-dev/sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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