Skip to main content

Official Python client for the Socialstats Enterprise API

Project description

Socialstats Python SDK

Official Python client for the Socialstats Enterprise API.

API Base URL: https://api.socialstats.com
API Key Access: Please contact api@socialstats.com


Requirements

  • Python >= 3.10

Installation

Install from PyPI:

pip install socialstats-sdk

For local development:

pip install -e ".[dev]"

Quick Start

from socialstats_sdk import SocialstatsClient

client = SocialstatsClient(api_key="YOUR_API_KEY")

# API status
status = client.info.status()

# Creator information
creator = client.creators.info(socialstats_creator_id="abcd1234")

# Creator statistics
creator_stats = client.creators.stats(
    socialstats_creator_id="abcd1234",
    source="instagram",
)

# Post statistics
post_stats = client.posts.stats(
    socialstats_creator_id="abcd1234",
    source_id="instagram",
    post_id="1234567890",
)

Authentication

All requests include your API key in the apikey header.

You can request an API key by contacting api@socialstats.com.

We recommend storing your key securely in environment variables:

export SOCIALSTATS_API_KEY=your_key_here

Available Resource Clients

  • client.info
  • client.creators
  • client.posts

Info endpoints:

  • client.info.sources() -> /sources
  • client.info.status() -> /status
  • client.info.uptime_check() -> /uptime_check
  • client.info.definitions() -> /definitions

Creator endpoints:

  • client.creators.info(...) -> /creators/info
  • client.creators.stats(...) -> /creators/stats
  • client.creators.historic_stats(...) -> /creators/historic_stats
  • client.creators.audience(...) -> /creators/audience
  • client.creators.audience_details(country_code=..., ...) -> /creators/audience/details
  • client.creators.activities(...) -> /creators/activities
  • client.creators.content(...) -> /creators/content
  • client.creators.top_posts(...) -> /creators/top_posts
  • client.creators.search(q=..., ...) -> /creators/search
  • client.creators.add_link_request(link=..., ...) -> /creators/link_request
  • client.creators.remove_link_request(link=..., ...) -> /creators/link_request

Post endpoints:

  • client.posts.stats(...) -> /posts/stats
  • client.posts.historic_stats(...) -> /posts/historic_stats

Error Handling

from socialstats_sdk import SocialstatsAPIError, SocialstatsTransportError

try:
    client.creators.info(socialstats_creator_id="invalid")
except SocialstatsAPIError as exc:
    print(f"API error: {exc}")
except SocialstatsTransportError as exc:
    print(f"Transport error: {exc}")

Development

To work on the SDK locally:

git clone https://github.com/songstats/socialstats-python-sdk.git
cd socialstats-python-sdk
pip install -e ".[dev]"
pytest

Versioning

This SDK follows Semantic Versioning (SemVer).


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

socialstats_sdk-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

socialstats_sdk-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for socialstats_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 38a02113ee8a984ec93b764ab599896364de058370d41d73d0ec02a08e1174bc
MD5 2f296e2f70cf0c7ba809b2a474865ef3
BLAKE2b-256 4bfc75bbd28ba7d5b68545c1972bb88d2c6a173407a7bff0659f041ad493f74d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for socialstats_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e990464de7b11d9efe12a3a19155c1638a5fcfc53d2d46f054c1cf11d0f48a7
MD5 6340d3ec2140c42f29fecfa9e39016d0
BLAKE2b-256 935bd5b378d45021a255a752673dfdefc1fd698c10c1413d34eb2586ef20db1a

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