Python Wrapper for the Identory browser automation platform
Project description
Identory Python Wrapper
A comprehensive Python wrapper for the Identory browser automation platform. This library provides a simple and intuitive interface for interacting with Identory's API endpoints, including profile management, settings configuration, tools, status management, groups, and presets.
🚀 Features
- Complete API Coverage - Full support for all Identory API endpoints
- Pyppeteer Compatibility - Works perfectly with Pyppeteer which is a port of JS Puppeteer
- Type Safety - Comprehensive type hints for better IDE support
- Error Handling - Custom exceptions with detailed error messages
- Auto-Launch - Automatically starts the Identory CLI service
- Cross-Platform - Works on Windows, macOS, and Linux
- Easy to Use - Simple, intuitive API design
- Well Documented - Extensive documentation and examples
📦 Installation
From PyPI (Recommended)
pip install identory
From Source
git clone https://github.com/okoyausman/identory-python-wrapper.git
cd identory-python-wrapper
pip install -e .
🏁 Quick Start
from identory import IdentoryWrapper
# Initialize the client (this will auto-launch Identory CLI)
client = IdentoryWrapper("your-access-token")
# Get all profiles
profiles = client.get_profiles()
print(f"Found {len(profiles)} profiles")
# Create a new profile
profile = client.create_profile("My Browser Profile")
print(f"Created profile: {profile['name']}")
# Start a profile
result = client.start_profile(profile['id'], headless=False)
print(f"Profile started with WebSocket: {result['browserWSEndpoint']}")
# Connect with Pyppeteer (optional)
import asyncio
from pyppeteer import connect
async def quick_automation():
browser = await connect(browserWSEndpoint=result['browserWSEndpoint'])
page = await browser.newPage()
await page.goto('https://example.com')
await browser.close()
client.stop_profile(profile['id'])
# Run automation
asyncio.run(quick_automation())
📚 API Reference
Client Initialization
from identory import IdentoryWrapper
client = IdentoryWrapper(
access_token="your-access-token",
base_url="http://127.0.0.1", # Default localhost
port=3005, # Default port
timeout=30 # Default timeout
)
Profile Management
# Get all profiles
profiles = client.get_profiles()
# Get specific profile
profile = client.get_profile("profile-id")
# Create a new profile
profile = client.create_profile(
name="Test Browser",
timezone="UTC",
platform="Win32"
)
# Update a profile
updated_profile = client.update_profile(
"profile-id",
name="Updated Name",
timezone="America/New_York"
)
# Start a profile
result = client.start_profile(
"profile-id",
headless=False,
skipConnectionCheck=False,
changeIP=True
)
# Stop a profile
client.stop_profile("profile-id")
# Get running profiles
running = client.get_running_profiles()
# Get profile status
status = client.get_profile_status("profile-id")
# Change profile IP
client.change_profile_ip("profile-id")
# Import/Export profiles
client.import_profile("path/to/profile.zip", {"name": "Imported Profile"})
client.export_profile("profile-id", "path/to/export.zip")
# Cookie management
cookies = client.get_profile_cookies("profile-id")
client.export_profile_cookies("profile-id", "cookies.json")
# Profile warmup
client.start_profile_warmup(
"profile-id",
["https://www.google.com", "mountain", "https://www.youtube.com"],
skipConnectionCheck=False
)
# Human typing
client.human_typing("profile-id", "Hello, world!")
# Delete profiles
client.delete_profile("profile-id")
client.delete_profiles(["id1", "id2"])
Settings Management
# Get default settings
settings = client.get_default_settings()
# Set default settings
client.set_default_settings(
autoStartProfiles=False,
maxConcurrentProfiles=5
)
Tools & Utilities
# Check proxy connection
proxy_result = client.check_proxy(
"proxy.example.com",
8080,
"http://",
"username",
"password"
)
# Get IP information
ip_info = client.get_ip_info(
"proxy.example.com",
8080,
"socks5://",
"username",
"password"
)
Status Management
# Get all statuses
statuses = client.get_statuses()
# Create a status
status = client.create_status("In Progress", "primary")
# Update a status
client.update_status("status-id", name="Completed", color="success")
# Delete a status
client.delete_status("status-id")
Group Management
# Get all groups
groups = client.get_groups()
# Create a group
group = client.create_group("Work Group", "blue")
# Update a group
client.update_group("group-id", name="Updated Group", color="green")
# Delete a group
client.delete_group("group-id")
Preset Management
# Get all presets
presets = client.get_presets()
# Create a preset with proxy
preset = client.create_preset(
"Proxy Preset",
useProxy=2,
proxyType="socks5://",
proxyHost="127.0.0.1",
proxyPort="5000",
proxyUsername="user",
proxyPassword="pass"
)
# Create a preset with screen size
preset = client.create_preset(
"Desktop Preset",
screenSize="1920x1080",
platform="Win32",
platformVersionLimit=2
)
# Update a preset
client.update_preset("preset-id", proxyHost="new.proxy.com")
# Delete a preset
client.delete_preset("preset-id")
🔧 Configuration
Access Token
You need a valid Identory access token to use this wrapper. You can obtain one from your Identory dashboard.
Auto-Launch Behavior
The wrapper automatically attempts to launch the Identory CLI service when initialized. It supports:
- Windows:
%userprofile%\AppData\Local\Programs\identory\identory.exe - macOS:
/Applications/IDENTORY.app/Contents/MacOS/IDENTORY - Linux:
identory(must be in PATH)
Custom Configuration
client = IdentoryWrapper(
access_token="your-token",
base_url="http://localhost", # Custom base URL
port=8080, # Custom port
timeout=60 # Custom timeout
)
🛠️ Advanced Usage
Pyppeteer Integration
The Identory wrapper works seamlessly with Pyppeteer for browser automation. Here's how to connect Pyppeteer to an Identory profile:
import asyncio
from identory import IdentoryWrapper
from pyppeteer import connect
async def browser_automation():
# Initialize Identory client
client = IdentoryWrapper("your-access-token")
# Start a profile
start_response = client.start_profile(
"your-profile-id",
headless=False
)
# Connect Pyppeteer to the profile
browser = await connect(
browserWSEndpoint=start_response['browserWSEndpoint'],
defaultViewport=None
)
# Get a new page
page = await browser.newPage()
# Navigate to a website
await page.goto('https://example.com', timeout=30000)
# Perform actions
await page.type('input[name="username"]', 'random-username')
await page.type('input[name="passwd"]', 'random-password')
await page.click('button[type="submit"]')
# Wait for navigation
await page.waitForNavigation()
# Take a screenshot
await page.screenshot({'path': 'webpage.png'})
# Close browser
await browser.close()
# Stop the profile
client.stop_profile("your-profile-id")
# Run the automation
asyncio.run(browser_automation())
Error Handling
from identory import IdentoryWrapper, APIError, AuthenticationError, NotFoundError
try:
profile = client.get_profile("invalid-id")
except NotFoundError:
print("Profile not found")
except AuthenticationError:
print("Invalid access token")
except APIError as e:
print(f"API Error: {e}")
Working with Profiles and Presets
# Create a profile from a preset
preset = client.get_preset("preset-id")
profile = client.create_profile(
name="Profile from Preset",
**preset # Apply preset settings
)
# Bulk operations
profile_ids = ["id1", "id2", "id3"]
client.delete_profiles(profile_ids)
Custom Screen Sizes
# Create preset with custom screen size
preset = client.create_preset(
"Custom Screen",
hasCustomScreenSize=True,
customScreenWidth=1366,
customScreenHeight=768
)
Mobile Profiles
# Create mobile preset
mobile_preset = client.create_preset(
"Mobile Safari",
platform="iPhone",
mobileBrowser="SAFARI"
)
🐛 Troubleshooting
Common Issues
-
Identory CLI not found
Solution: Ensure Identory is properly installed and accessible -
Connection refused
Solution: Check if the port is available and Identory is running -
Authentication failed
Solution: Verify your access token is valid and not expired -
Profile not found
Solution: Ensure the profile ID exists and you have access to it
📋 Requirements
- Python 3.8+
- Identory application installed
- Valid Identory access token
Optional Dependencies
For browser automation with Pyppeteer:
pip install pyppeteer
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
📞 Support
- Documentation: https://docs.identory.com
- Issues: GitHub Issues
- Email: usmanokoya10@gmail.com
Made with ❤️ for the Identory community
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
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 identory-0.1.1.tar.gz.
File metadata
- Download URL: identory-0.1.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85d35fed74c59aa4f8059a781e882e718fd8e72beed2ac71a86a4478d8e24749
|
|
| MD5 |
f87441f1e17a1341340e754c7813b8b9
|
|
| BLAKE2b-256 |
3cffb36ccc9004ef060e89184c5b1f1d0ca6f73a2bbedb95a7a75cb9b156f89e
|
File details
Details for the file identory-0.1.1-py3-none-any.whl.
File metadata
- Download URL: identory-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc1f2d8b49e89205f97338eb64c040475d6ee303c471b8acaafe277a578fd3bb
|
|
| MD5 |
a660528e9efc158c1960863d036e0646
|
|
| BLAKE2b-256 |
e7021193a9754984e4fdab9b869acd4cb8a47aad18dd4be8290db6815a94c0ea
|