Reusable Python toolkit for LinkedIn lead collection, outreach automation, and lead analytics.
Project description
linkedin-autobot
linkedin-autobot helps you collect LinkedIn profile data, analyze leads, and automate outreach.
Install
pip install linkedin-autobot
For local browser automation, install automation dependencies manually:
pip install "linkedin-autobot[automation]"
python -m playwright install chromium
Choose Your Mode
- Hosted mode: recommended for production (stable, backend-driven).
- Local bot mode: runs browser automation on the user machine.
- Colab/Jupyter mode: use async bot (
AsyncLinkedInBot).
Environment Variables
Hosted:
LINKEDIN_AUTOBOT_BASE_URLLINKEDIN_AUTOBOT_API_KEY(optional if your backend does not require it)
Local bot:
LINKEDIN_EMAILLINKEDIN_PASSWORDGMAIL_APP_PASSWORD(optional, for automatic 2FA email verification handling)
Analytics (optional):
GOOGLE_API_KEY
2FA Email Verification Handling
When LinkedIn requires email verification (common in automated login scenarios), the bot can automatically fetch and submit the verification code from your Gmail inbox.
Setup:
- Enable 2-Step Verification on your Google account: https://myaccount.google.com/security
- Generate a Gmail App Password: https://myaccount.google.com/apppasswords
- Set
GMAIL_APP_PASSWORDenvironment variable or pass it toLinkedInBot:
with LinkedInBot.from_env(headless=False) as bot:
# Automatically handles 2FA if LinkedIn requires verification
bot.login()
How it works:
- Detects LinkedIn's verification challenge
- Connects to Gmail IMAP
- Fetches the 6-digit code from LinkedIn's verification email
- Automatically enters the code and continues login
Requirements:
- Gmail account (same as your LinkedIn email)
- 2-Step Verification enabled on Google account
- Gmail App Password (from https://myaccount.google.com/apppasswords)
- Gmail IMAP access enabled
Tutorial: Hosted Client
1) Create client with from_env(...)
from linkedin_autobot import LinkedInAutobotClient
client = LinkedInAutobotClient.from_env()
2) Collect profile by name with collect_profile_by_name(name)
profile = client.collect_profile_by_name("Satya Nadella")
print(profile.profile_url, profile.full_name, profile.title)
Returned data fields:
profile.profile_urlprofile.full_nameprofile.titleprofile.locationprofile.aboutprofile.experienceprofile.statusprofile.metadata
3) Collect profile by URL with collect_profile_by_url(profile_url)
profile = client.collect_profile_by_url("https://www.linkedin.com/in/satyanadella/")
print(profile.full_name, profile.location)
This method returns the same LinkedInProfile fields listed above.
4) Analyze profile with analyze_profile(profile, prompt)
analysis = client.analyze_profile(
profile,
prompt="Score this lead and suggest the best outreach angle."
)
print(analysis.score, analysis.decision_maker_level)
5) Send outreach with send_connection_request(profile_url, message=None)
sent = client.send_connection_request(
"https://www.linkedin.com/in/satyanadella/",
message="Hi Satya, I would love to connect."
)
print(sent)
Tutorial: Local Bot
1) Install local requirements, then create bot with from_env(...) and login with login()
from linkedin_autobot import LinkedInBot
with LinkedInBot.from_env(headless=False) as bot:
bot.login()
Tutorial: Colab / Jupyter (Async)
In notebook environments, use AsyncLinkedInBot (not LinkedInBot sync API).
import asyncio
from linkedin_autobot import AsyncLinkedInBot
async def run():
async with AsyncLinkedInBot.from_env(headless=True) as bot:
await bot.login()
profile = await bot.collect_profile_by_name("Satya Nadella")
print(profile.profile_url, profile.full_name)
await run()
2) Open a profile with visit_profile(profile_url)
with LinkedInBot.from_env(headless=False) as bot:
bot.login()
bot.visit_profile("https://www.linkedin.com/in/satyanadella/")
3) Find profile URL with find_profile_url_by_name(name)
with LinkedInBot.from_env(headless=False) as bot:
bot.login()
profile_url = bot.find_profile_url_by_name("Satya Nadella")
print(profile_url)
4) Collect profile with collect_profile(profile_url)
with LinkedInBot.from_env(headless=False) as bot:
bot.login()
profile = bot.collect_profile("https://www.linkedin.com/in/satyanadella/")
print(profile.full_name, profile.title)
Returned data fields:
profile.profile_urlprofile.full_nameprofile.titleprofile.locationprofile.aboutprofile.experienceprofile.statusprofile.metadata
5) Collect by name with collect_profile_by_name(name)
with LinkedInBot.from_env(headless=False) as bot:
bot.login()
profile = bot.collect_profile_by_name("Satya Nadella")
print(profile.profile_url)
This method returns the same LinkedInProfile fields listed above.
6) Send request with send_connection_request(profile_url, message=None)
with LinkedInBot.from_env(headless=False) as bot:
bot.login()
sent = bot.send_connection_request(
"https://www.linkedin.com/in/satyanadella/",
message="Hi Satya, let's connect."
)
print(sent)
7) Close bot manually with close()
from linkedin_autobot import LinkedInBot
bot = LinkedInBot.from_env(headless=False)
bot.login()
# ... your actions ...
bot.close()
Tutorial: Local Analytics Engine
Analyze with LeadAnalyticsEngine.analyze(profile, prompt)
from linkedin_autobot import LeadAnalyticsEngine, LinkedInProfile
profile = LinkedInProfile(
profile_url="https://www.linkedin.com/in/example/",
full_name="Jane Founder",
title="Founder & CEO",
about="B2B growth and sales.",
)
engine = LeadAnalyticsEngine() # uses GOOGLE_API_KEY if available
result = engine.analyze(profile, "Score this lead and propose outreach.")
print(result.score, result.insights_strategic)
Tutorial: Django Helpers
profile_from_lead_model(lead)
from linkedin_autobot.django import profile_from_lead_model
profile = profile_from_lead_model(lead_instance)
analyze_lead_model(lead, prompt, api_key=None)
from linkedin_autobot.django import analyze_lead_model
analysis = analyze_lead_model(lead_instance, "Score this lead.")
print(analysis.score)
Data Models
LinkedInCredentials(email, password)LinkedInProfile(...)AnalysisResult(...)
Exceptions
LinkedinAutobotErrorMissingDependencyErrorAuthenticationErrorScrapingError
Practical Notes
LinkedInBot.login()performs preflight checks and raises clear instructions when Chromium is missing.- If local browser automation is blocked by OS permissions, use hosted mode.
- For production-grade stability, hosted mode is recommended.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file linkedin_autobot-0.1.7.tar.gz.
File metadata
- Download URL: linkedin_autobot-0.1.7.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ff489c4d484088a98751dd4148701d9f207f6dc01c92fe821c5ee7b4b6da436
|
|
| MD5 |
103f7e5752620888ac1954f2d1187e39
|
|
| BLAKE2b-256 |
4550173493a7f8148713fd2cc1f505fb681e6cf9ea3813f3911ab6a6d0daef04
|
File details
Details for the file linkedin_autobot-0.1.7-py3-none-any.whl.
File metadata
- Download URL: linkedin_autobot-0.1.7-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
448d5f8840289c6922091fb5cc2cc5733a869344b4d35b5799d8de2f12e9c27d
|
|
| MD5 |
ce558a71020597f93d799166cdadcb86
|
|
| BLAKE2b-256 |
178f04073b23850a25738b0f69cc8190ab094b1e95b4562657177db85f5f598a
|