Facebook SDK (Python)
The official Python client for the GetSocialAPI Facebook API. A thin layer over the REST API: auth, automatic retries and typed exceptions — raw Facebook JSON in, raw JSON out. Every list method returns one page; walk cursors yourself (see the API Reference pages).
Endpoint semantics — parameters, response fields, limits and notes — live in the Facebook API Reference. This page covers only the library itself.
Source code: github.com/GetSocialAPI/Facebook-Scraper-API
Installation
pip install git+https://github.com/GetSocialAPI/Facebook-Scraper-API.git
Requires Python 3.9+ and requests.
Client
from getsocialapi_facebook import Client
client = Client(api_key="gsa_live_...")
| Parameter | Default | Description |
|---|---|---|
api_key | env GETSOCIALAPI_FB_API_KEY | your API key |
base_url | Facebook API endpoint | override only for testing |
timeout | 30 | per-request timeout, seconds |
max_retries | 3 | retries on 429/500/502/503/504 and network errors |
All endpoints hang off client.fb.* (alias client.facebook.*) — see the
Facebook API Reference for what is available and
what each call returns.
Pagination
Every method returns one raw page as received. Pass the cursor from the previous
response (next_max_id as max_id for Instagram, page_info.end_cursor as
after for Facebook) until it is null / has_next_page is false.
Errors
| Exception | HTTP | Notes |
|---|---|---|
GetSocialFacebookError | — | base class; also network errors |
BadRequestError | 400 | bad parameters |
APIKeyError | 401 | invalid key |
RateLimitError | 429 | .limit from the response |
UpstreamError | 502 | temporary upstream error — retried automatically |
ServiceUnavailableError | 503 | service overloaded — retried automatically |
from getsocialapi_facebook import RateLimitError
try:
client.fb.members(group_id)
except RateLimitError as e:
print("limit:", e.limit)
Validation
Client-side checks raise ValueError before any network call:
group_id/user_id — digits up to 20 chars.