ldraney-linkedin-sdk (0.1.2)
Published 2026-03-01 18:20:19 +00:00 by forgejo_admin
Installation
pip install --index-url ldraney-linkedin-sdkAbout this package
Python SDK for the LinkedIn API v202510
linkedin-sdk
Python SDK for the LinkedIn API v202510.
Installation
pip install ldraney-linkedin-sdk
Quick Start
from linkedin_sdk import LinkedInClient
# Reads LINKEDIN_ACCESS_TOKEN and LINKEDIN_PERSON_ID from env
client = LinkedInClient()
# Create a text post
result = client.create_post("Hello from Python!")
print(result) # {'postUrn': 'urn:li:share:...', 'statusCode': 201}
# Get user info
info = client.get_user_info()
print(info['name'])
# Delete a post
client.delete_post("urn:li:share:7...")
Authentication
Set environment variables:
export LINKEDIN_ACCESS_TOKEN="your_token"
export LINKEDIN_PERSON_ID="your_person_id"
Or pass directly:
client = LinkedInClient(access_token="...", person_id="...")
OAuth
from linkedin_sdk import LinkedInClient
# Build auth URL (no client needed)
url = LinkedInClient.get_auth_url(
client_id="...",
redirect_uri="http://localhost:8080/callback",
scopes=["openid", "profile", "email", "w_member_social"],
)
# Exchange code for token (classmethod)
token = LinkedInClient.exchange_code(
code="auth_code",
client_id="...",
client_secret="...",
redirect_uri="http://localhost:8080/callback",
)
# Refresh token
new_token = LinkedInClient.refresh_token(
refresh_token="...",
client_id="...",
client_secret="...",
)
License
MIT
Requirements
Requires Python: >=3.10