Python SDK
lidmeo: installing, calling, errors, pagination, agencies, webhooks.
pip install lidmeoPython 3.8 or later, the standard library only.
from lidmeo import Lidmeo
client = Lidmeo() # reads LIDMEO_API_KEY (lid_live_… or lid_test_…)
# The prospects who replied and wait for you
page = client.prospects.list(view="to_handle")
# Set your stage
client.prospects.update("pros_…", crm_stage="stg_…")
# Add a prospect to follow (nothing is sent to them)
client.prospects.upsert(match_on="linkedin_url", linkedin_url="https://www.linkedin.com/in/claire-durand")One method per operation, grouped by resource: client.prospects.notes.create(…), client.webhook_endpoints.rotate_secret(…), client.test.simulate(…). Parameters are passed as keyword arguments or in a dict; responses are dicts.
Options
| Option | Default | |
|---|---|---|
api_key | the LIDMEO_API_KEY variable | a key or an OAuth token |
account | none | the account targeted by an agency key (acct_…) |
language | none (French) | the language of errors, "fr" or "en" (Accept-Language header) |
max_retries | 2 | retries of a failing request (network, 408, 429, 5xx, and the transient 409 refusals of a write), never of a failed send or of switched-off sends (send_failed, sends_disabled) |
timeout | 60.0 | timeout of one attempt, in seconds |
base_url | https://api.lidmeo.com |
Per call: idempotency_key=… and lidmeo_account=….
Errors
from lidmeo import LidmeoError
try:
client.prospects.approve_invitation("pros_…")
except LidmeoError as error:
if error.code == "daily_cap_reached":
print("Next slot:", error.problem.get("next_slot_at"))
else:
raiseerror.status, error.code (stable: branch on it, never on the text), error.detail, error.request_id (to give to support), error.errors and error.problem. A network cut gives status 0 and code "network_error".
Pagination
for prospect in client.paginate(client.prospects.list, view="to_follow_up", limit=100):
print(prospect["full_name"])Webhooks
from lidmeo import verify_webhook, WebhookVerificationError
try:
event = verify_webhook(secret, raw_body, request.headers) # the raw body
except WebhookVerificationError:
return "", 400
if event["type"] == "prospect.replied":
prospect = event["data"]["object"]