Skip to main content

Official synchronous Python SDK for Linked API.

Project description

This official Python SDK is the synchronous way to integrate with Linked API. It provides pre-defined workflow operations, direct account/statistics methods, admin APIs, authentication headers, polling, and structured error responses.

Get started

To get started with Linked API Python SDK, read these essential guides first:

  1. Core concepts - understand how Linked API works.
  2. Installation & authorization - install the SDK and authorize it.
  3. Predefined vs. custom workflows - choose ready-made operations or custom workflow definitions.
  4. Handling results and errors - process successful data and action errors.
  5. Persisting and cancelling workflows - save, resume, and cancel workflows.

Install the package:

pip install linkedapi

Initialize the client:

from linkedapi import LinkedApi, LinkedApiConfig

linkedapi = LinkedApi(
    LinkedApiConfig(
        linked_api_token="your-linked-api-token",
        identification_token="your-identification-token",
    )
)

Run a predefined workflow and poll the result:

from linkedapi import FetchPersonParams

workflow = linkedapi.fetch_person.execute(
    FetchPersonParams(
        person_url="https://www.linkedin.com/in/john-doe",
        retrieve_experience=True,
        retrieve_posts=True,
        posts_retrieval_config={"limit": 10},
    )
)

result = linkedapi.fetch_person.result(workflow.workflow_id)
if result.data:
    print(result.data.name)
for error in result.errors:
    print(error.type, error.message)

Execute a custom workflow:

workflow = linkedapi.custom_workflow.execute(
    {
        "actionType": "st.searchCompanies",
        "term": "Tech Inc",
        "filter": {
            "sizes": ["51-200", "2001-5000"],
            "locations": ["San Francisco", "New York"],
            "industries": ["Software Development"],
        },
        "then": {"actionType": "st.openCompanyPage", "basicInfo": True},
    }
)

result = linkedapi.custom_workflow.result(workflow.workflow_id)
print(result.data)

Continue polling after a workflow timeout:

from linkedapi import LinkedApiWorkflowTimeoutError

try:
    result = linkedapi.fetch_person.result(workflow.workflow_id, timeout=30.0)
except LinkedApiWorkflowTimeoutError as error:
    result = linkedapi.fetch_person.result(error.workflow_id)

Cancel a workflow:

cancelled = linkedapi.fetch_person.cancel(workflow.workflow_id)
print(cancelled)

License

This project is licensed under the MIT License. See LICENSE for details.

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

linkedapi-1.3.0.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

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

linkedapi-1.3.0-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

Details for the file linkedapi-1.3.0.tar.gz.

File metadata

  • Download URL: linkedapi-1.3.0.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for linkedapi-1.3.0.tar.gz
Algorithm Hash digest
SHA256 26df981ffc46fa66e68e22703df508ea60842bac4631a88c9aff54d0fccb692b
MD5 13a6be189bf79eec6f8ded9b30d67212
BLAKE2b-256 43816dbab3b00a3bf59c0c97a413f4b425968e611a32b63a7773102a651b4bba

See more details on using hashes here.

Provenance

The following attestation bundles were made for linkedapi-1.3.0.tar.gz:

Publisher: publish.yaml on Linked-API/linkedapi-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file linkedapi-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: linkedapi-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 56.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for linkedapi-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 777c562410a4f1ea49cc880a1b35d0e8007b37e8cd057c8ba532bae49f091a4e
MD5 ac9a05614c87e57d11c47b6c33c83d3f
BLAKE2b-256 987e0463e5de7b9e8965892e8d6e6baad77cd90a38fb0e39e0737f284ff92fcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for linkedapi-1.3.0-py3-none-any.whl:

Publisher: publish.yaml on Linked-API/linkedapi-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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