Skip to main content

Official Python SDK for the SociaHive API — social media management, automation flows, and analytics.

Project description

sociahive

Official Python SDK for the SociaHive API.

pip install sociahive

Quickstart

from sociahive import SociaHive

sh = SociaHive(api_key="sk_...")

accounts = sh.accounts.list()
print(f"Connected: {[a['platform'] for a in accounts['data']]}")

post = sh.posts.create(
    text="Hello from Python!",
    platforms=[{"platform": "instagram", "account_id": accounts["data"][0]["id"]}],
    schedule_type="scheduled",
    scheduled_at="2026-06-01T09:00:00Z",
    timezone="UTC",
)
print(f"Scheduled post {post['id']}")

Auth

Pass exactly one of api_key (long-lived) or oauth_token (per-user OAuth):

sh = SociaHive(api_key="sk_...")
sh = SociaHive(oauth_token="sh_at_...")

Generate keys at https://www.sociahive.com/settings?tab=api-keys.

Context manager

The client holds an httpx.Client connection pool. Use with for tight scopes:

with SociaHive(api_key="sk_...") as sh:
    for flow in sh.flows.list()["data"]:
        if flow["status"] == "draft":
            sh.flows.activate(flow["id"])

Outside a with block, call sh.close() when you're done.

Error handling

from sociahive import SociaHive, SociaHiveError

try:
    sh.posts.create(text="...", platforms=[...])
except SociaHiveError as err:
    if err.is_auth_error:
        print("Bad API key or insufficient scope")
    elif err.is_rate_limited:
        print("Slow down — 1000 req/hr default")
    else:
        print(f"HTTP {err.status}: {err}")

What's covered

Domain Methods
sh.accounts list
sh.posts list, get, create, update, schedule, publish, cancel, bulk
sh.flows list, get, create, update, delete, activate, deactivate, add_node, update_node, add_edge, stats, collected_data, generate
sh.analytics get, export

For other endpoints, fall back to httpx directly with X-API-Key. Full spec: https://www.sociahive.com/api/v1/openapi.json.

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

sociahive-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

sociahive-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sociahive-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dff5502e9cce642e41f581d11d600e08d3220b02553784d07d7666677404d5b7
MD5 884e3a573fee4a5c5d39fce1212f8dd5
BLAKE2b-256 f9aa3fb7b04504a57921fc45a6a780e0178f4e2589bae29224905fefe99b0d00

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sociahive-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ad84b6b0e30730d0fadab6116a458bc2fb7454b524c8878dca95fbaaa789a1b
MD5 08b19cebbcfc67340691449161de768d
BLAKE2b-256 e2d3e3dda507c61ea2588bb628431ebae5b436803d235d12a85f31b32045a888

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