SDKs
Written from the ws/sdks branch README; the packages are not published yet. Confirm names and examples after the merge.
Official clients for TypeScript and Python. They are generated from the same source as this reference, so every endpoint, parameter and response type is covered and cannot drift from the API.
Install#
npm install socialscrape
pip install socialscrapeUse#
import { SocialScrape } from "socialscrape";
const client = new SocialScrape({ apiKey: process.env.SOCIALSCRAPE_API_KEY! });
const { data, credits_remaining } = await client.github.user({ handle: "torvalds" });import os
from socialscrape import SocialScrape
client = SocialScrape(api_key=os.environ["SOCIALSCRAPE_API_KEY"]) # or leave it out to read SOCIALSCRAPE_API_KEY
res = client.github.user(handle="torvalds")
print(res.data, res.credits_remaining)Naming#
Method names come from the endpoint id. Both clients group methods by platform. The TypeScript client uses camelCase (client.github.userRepositories()); the Python client uses snake_case (client.github.user_repositories()), with an AsyncSocialScrape twin for asyncio. Parameters keep their API names. Every method returns the envelope, so credits_charged, credits_remaining and cached are always available.
Errors and webhooks#
- A failed request raises a typed error per error code that carries
code,retryableandrequest_id, the same fields as the failure envelope. Both clients retry retryable failures with backoff and readRetry-After. - Use the clients on your server only: the API key is a secret and must not ship in browser or mobile code.
- Webhook signatures are verified with the short functions on that page; the clients do not include a helper yet.
Without an SDK#
Everything is plain HTTP and JSON, so any language works. Each endpoint page has curl, Python and TypeScript examples that need no library beyond an HTTP client, and the OpenAPI document lets you generate a client in any other language.