Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ from socialapis import Facebook, Instagram

fb = Facebook(api_token="...")
page = fb.get_page_info("EngenSA")
print(page.name, page.likes, page.category)
print(page.title, page.followers_count, page.category)

ig = Instagram(api_token="...")
profile = ig.get_profile_details("instagram")
print(profile.username, profile.followers)
print(profile.username, profile.followers_count)
```

**[Get a free API token →](https://socialapis.io/auth/signup)** — 200 calls/month, no credit card
Expand Down Expand Up @@ -244,7 +244,7 @@ async def main():
for slug in ["EngenSA", "Microsoft", "GitHub"]
])
for page in pages:
print(page.name, page.followers)
print(page.title, page.followers_count)

asyncio.run(main())
```
Expand Down
8 changes: 5 additions & 3 deletions examples/migrate-from-kevinzg.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def main() -> None:
"Out of credits. Upgrade at https://socialapis.io/pricing"
) from None

# Same fields kevinzg returned, but now typed (page.name not page["name"])
print(f"Page: {page.name}")
# Same data kevinzg returned, but now typed (page.title not page["name"]).
# Field names match the API exactly — see PageInfo in the SDK docs.
print(f"Page: {page.title}")
print(f" Category: {page.category}")
print(f" Likes: {page.likes:,}" if page.likes else " Likes: n/a")
print(f" Likes: {page.likes_count:,}" if page.likes_count else " Likes: n/a")
print(f" Followers:{page.followers_count:,}" if page.followers_count else "")

# kevinzg's `for post in get_posts(...)` equivalent — paginate via cursors
result = fb.get_page_posts("EngenSA")
Expand Down
16 changes: 10 additions & 6 deletions examples/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def main() -> None:
page = fb.get_page_info("EngenSA")
except (RateLimitError, InsufficientCreditsError) as exc:
raise SystemExit(f"Facebook call failed: {exc}") from exc
print(f"Facebook page: {page.name}")
print(f"Facebook page: {page.title}")
print(f" Category: {page.category}")
print(f" Likes: {page.likes:,}" if page.likes else " Likes: n/a")
print(f" Followers: {page.followers:,}" if page.followers else " Followers: n/a")
print(f" Verified: {page.verified}")
print(f" Likes: {page.likes_count:,}" if page.likes_count else " Likes: n/a")
print(f" Followers: {page.followers_count:,}" if page.followers_count else " Followers: n/a")
print(f" Bio: {(page.bio or '')[:80]}")
print()

# Instagram
Expand All @@ -59,8 +59,12 @@ def main() -> None:
raise SystemExit(f"Instagram call failed: {exc}") from exc
print(f"Instagram profile: @{profile.username}")
print(f" Full name: {profile.full_name}")
print(f" Followers: {profile.followers:,}" if profile.followers else " Followers: n/a")
print(f" Posts: {profile.posts_count}")
print(
f" Followers: {profile.followers_count:,}"
if profile.followers_count
else " Followers: n/a"
)
print(f" Media: {profile.media_count}")
print(f" Verified: {profile.is_verified}")


Expand Down