Skip to main content

Python SDK for the LinkedIn API v202510

Project description

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

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

ldraney_linkedin_sdk-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

ldraney_linkedin_sdk-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ldraney_linkedin_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db18f8efb2ea38d684e9728c9ec7d68ea383b5910c66895e5405d0d106dffa98
MD5 37a5adfa634d970b8a1f99c7812d004a
BLAKE2b-256 13fa22e2af5237ec3ba81340386f3f4dbbd56590bef8203ed4634a93ccb1cf0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ldraney_linkedin_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79cb978ca4c08edc198dcac77e63bccd133e21cf96494061d656078178aadd4b
MD5 2c3ecea4c32cd7f2f46dabe6d29a4597
BLAKE2b-256 a766aa2bae20b89ef26b3079565dd0998b89158276ee108f4c3603a6da24415c

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