### Install Identory Python Wrapper Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Installs the Identory Python wrapper from PyPI, the recommended method for most users. Alternatively, installation from source is provided for development purposes. ```bash pip install identory ``` ```bash git clone https://github.com/okoyausman/identory-python-wrapper.git cd identory-python-wrapper pip install -e . ``` -------------------------------- ### Quick Start: Identory Automation with Playwright Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Demonstrates a quick start for using the Identory Python wrapper to manage browser profiles and integrate with Playwright for automation. It covers initializing the wrapper, creating, starting, and stopping profiles, and performing basic web automation tasks. ```python from identory import IdentoryWrapper import asyncio from playwright.async_api import async_playwright # Initialize the client (this will auto-launch Identory CLI) client = IdentoryWrapper(access_token="your-access-token", auto_launch=True) # 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']}") async def quick_automation(): playwright = await async_playwright().start() browser = await playwright.chromium.connect_over_cdp(result['browserWSEndpoint']) context = browser.contexts[0] if browser.contexts else await browser.new_context() page = context.pages[0] if context.pages else await context.new_page() await page.goto('https://example.com') await browser.close() client.stop_profile(profile['id']) # Run automation asyncio.run(quick_automation()) ``` -------------------------------- ### Start, Stop, and Manage Browser Profile Status (Python) Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Illustrates how to start browser profiles, obtain WebSocket and HTTP endpoints for automation, check running profiles, get individual profile status, and stop profiles using the Identory Python Wrapper. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create and start a profile profile = client.create_profile("Automation Browser") # Start profile (returns WebSocket endpoint) result = client.start_profile( profile['id'], headless=False, skipConnectionCheck=False, changeIP=True, enableDebugger=False ) ws_endpoint = result['browserWSEndpoint'] print(f"Browser WebSocket: {ws_endpoint}") print(f"Browser HTTP: {result.get('browserHTTPEndpoint')}") # Check running profiles running = client.get_running_profiles() print(f"Running profiles: {len(running)}") # Get profile status status = client.get_profile_status(profile['id']) print(f"Status: {status['status']}") # Stop profile when done client.stop_profile(profile['id']) print("Profile stopped") ``` -------------------------------- ### Custom Screen Sizes for Identory Presets (Python) Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md This Python example shows how to create an Identory preset with custom screen dimensions. It utilizes the `create_preset` method, setting `hasCustomScreenSize` to True and providing specific values for `customScreenWidth` and `customScreenHeight`. ```python # Create preset with custom screen size preset = client.create_preset( "Custom Screen", hasCustomScreenSize=True, customScreenWidth=1366, customScreenHeight=768 ) ``` -------------------------------- ### Install Playwright and Browsers (Bash) Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md This bash command installs the Playwright library and downloads the necessary browser binaries for it to function. This is an optional dependency for enabling browser automation features with the Identory wrapper. ```bash pip install playwright playwright install ``` -------------------------------- ### Create and Manage Browser Profiles (Python) Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Shows how to create, retrieve, and update browser profiles using the Identory Python Wrapper. Includes examples for basic profile creation and profiles with detailed configurations like proxy settings and timezone. ```python from identory import IdentoryWrapper, NotFoundError client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create a basic profile profile = client.create_profile(name="Test Browser") print(f"Created profile ID: {profile['id']}") # Create profile with full configuration profile = client.create_profile( name="Advanced Browser", timezone="America/New_York", platform="Win32", screenSize="1920x1080", useProxy=2, proxyType="socks5://", proxyHost="proxy.example.com", proxyPort="8080", proxyUsername="user", proxyPassword="pass" ) # Get all profiles profiles = client.get_profiles() for p in profiles: print(f"Profile: {p['name']} (ID: {p['id']})") # Get specific profile try: profile = client.get_profile(profile['id']) print(f"Profile status: {profile['status']}") except NotFoundError: print("Profile not found") # Update profile updated = client.update_profile( profile['id'], name="Updated Browser Name", timezone="UTC" ) print(f"Updated profile: {updated['name']}") ``` -------------------------------- ### Identory Tools and Utilities Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Provides examples for using Identory's tools and utilities, such as checking proxy connections and retrieving IP information. These functions are useful for verifying network configurations and gathering details about IP addresses. ```python # 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" ) ``` -------------------------------- ### Manage Profile Statuses with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Demonstrates how to retrieve, create, update, get, and delete custom statuses for profiles. This allows for organizing and categorizing profiles with visual identifiers like colors. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Get all statuses statuses = client.get_statuses() print(f"Available statuses: {len(statuses)}") # Create custom statuses in_progress = client.create_status("In Progress", "primary") completed = client.create_status("Completed", "success") failed = client.create_status("Failed", "danger") custom_color = client.create_status("Custom Status", "#FF5733") print(f"Created status: {in_progress['name']} (ID: {in_progress['id']})") # Update status updated = client.update_status( in_progress['id'], name="Currently Running", color="warning" ) # Get specific status status = client.get_status(completed['id']) print(f"Status: {status['name']} - Color: {status['color']}") # Assign status to profile profile = client.create_profile( "Tracked Profile", statusId=in_progress['id'] ) # Delete status client.delete_status(failed['id']) ``` -------------------------------- ### Profile Management API Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Provides endpoints for managing browser profiles, including creating, retrieving, updating, starting, stopping, and deleting profiles. ```APIDOC ## Profile Management ### Get All Profiles #### Description Retrieves a list of all available browser profiles. #### Method `GET` #### Endpoint `/profiles` #### Response (Success Response 200) - **profiles** (array) - A list of profile objects. ### Get Specific Profile #### Description Retrieves details for a specific browser profile by its ID. #### Method `GET` #### Endpoint `/profiles/{profile_id}` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to retrieve. #### Response (Success Response 200) - **profile** (object) - The profile object. ### Create Profile #### Description Creates a new browser profile with specified settings. #### Method `POST` #### Endpoint `/profiles` #### Parameters ##### Request Body - **name** (string) - Required - The name for the new profile. - **timezone** (string) - Optional - The timezone for the profile. - **platform** (string) - Optional - The operating system platform for the profile (e.g., "Win32"). #### Request Example ```json { "name": "Test Browser", "timezone": "UTC", "platform": "Win32" } ``` #### Response (Success Response 200) - **profile** (object) - The newly created profile object. ### Update Profile #### Description Updates an existing browser profile's settings. #### Method `PUT` #### Endpoint `/profiles/{profile_id}` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to update. ##### Request Body - **name** (string) - Optional - The new name for the profile. - **timezone** (string) - Optional - The new timezone for the profile. #### Request Example ```json { "name": "Updated Name", "timezone": "America/New_York" } ``` #### Response (Success Response 200) - **profile** (object) - The updated profile object. ### Start Profile #### Description Starts a specified browser profile. Can be configured to run in headless mode, skip connection checks, or change IP. #### Method `POST` #### Endpoint `/profiles/{profile_id}/start` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to start. ##### Request Body - **headless** (boolean) - Optional (default: `True`) - Whether to run the browser in headless mode. - **skipConnectionCheck** (boolean) - Optional (default: `False`) - Whether to skip the connection check. - **changeIP** (boolean) - Optional (default: `False`) - Whether to change the IP address before starting. #### Request Example ```json { "headless": false, "skipConnectionCheck": false, "changeIP": true } ``` #### Response (Success Response 200) - **browserWSEndpoint** (string) - The WebSocket endpoint for the running browser instance. ### Stop Profile #### Description Stops a running browser profile. #### Method `POST` #### Endpoint `/profiles/{profile_id}/stop` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to stop. ### Get Running Profiles #### Description Retrieves a list of all currently running browser profiles. #### Method `GET` #### Endpoint `/profiles/running` #### Response (Success Response 200) - **running_profiles** (array) - A list of running profile objects. ### Get Profile Status #### Description Retrieves the status of a specific browser profile. #### Method `GET` #### Endpoint `/profiles/{profile_id}/status` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to get the status for. #### Response (Success Response 200) - **status** (string) - The status of the profile (e.g., "running", "stopped"). ### Change Profile IP #### Description Changes the IP address for a specified browser profile. #### Method `POST` #### Endpoint `/profiles/{profile_id}/change_ip` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to change the IP for. ### Import Profile #### Description Imports a browser profile from a ZIP file. #### Method `POST` #### Endpoint `/profiles/import` #### Parameters ##### Request Body - **file_path** (string) - Required - The path to the profile ZIP file. - **options** (object) - Optional - Additional options for the import, e.g., `{"name": "Imported Profile"}`. ### Export Profile #### Description Exports a browser profile to a ZIP file. #### Method `POST` #### Endpoint `/profiles/{profile_id}/export` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to export. ##### Request Body - **export_path** (string) - Required - The path where the ZIP file will be saved. ### Get Profile Cookies #### Description Retrieves cookies for a specific browser profile. #### Method `GET` #### Endpoint `/profiles/{profile_id}/cookies` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to get cookies from. #### Response (Success Response 200) - **cookies** (array) - A list of cookie objects. ### Export Profile Cookies #### Description Exports cookies from a specific browser profile to a JSON file. #### Method `POST` #### Endpoint `/profiles/{profile_id}/export_cookies` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to export cookies from. ##### Request Body - **file_path** (string) - Required - The path where the JSON file will be saved. ### Start Profile Warmup #### Description Starts a warmup process for a profile, visiting a list of specified URLs. #### Method `POST` #### Endpoint `/profiles/{profile_id}/warmup` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to warm up. ##### Request Body - **urls** (array) - Required - A list of URLs to visit. - **skipConnectionCheck** (boolean) - Optional (default: `False`) - Whether to skip the connection check. #### Request Example ```json [ "https://www.google.com", "mountain", "https://www.youtube.com" ] ``` ### Human Typing #### Description Simulates human-like typing within a profile. #### Method `POST` #### Endpoint `/profiles/{profile_id}/human_typing` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to perform typing in. ##### Request Body - **text** (string) - Required - The text to be typed. ### Delete Profile #### Description Deletes a specific browser profile by its ID. #### Method `DELETE` #### Endpoint `/profiles/{profile_id}` #### Parameters ##### Path Parameters - **profile_id** (string) - Required - The ID of the profile to delete. ### Delete Profiles #### Description Deletes multiple browser profiles by their IDs. #### Method `DELETE` #### Endpoint `/profiles/bulk` #### Parameters ##### Request Body - **profile_ids** (array) - Required - A list of profile IDs to delete. ``` -------------------------------- ### Create, Get, Update, and Delete Presets with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Illustrates the management of reusable profile templates (presets) using the Identory Python wrapper. This includes creating various types of presets (proxy, screen size, custom screen, mobile), retrieving all presets, updating an existing preset, and deleting a preset. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create proxy preset proxy_preset = client.create_preset( "SOCKS5 Proxy Preset", useProxy=2, proxyType="socks5://", proxyHost="127.0.0.1", proxyPort="5000", proxyUsername="proxyuser", proxyPassword="proxypass" ) # Create screen size preset desktop_preset = client.create_preset( "Desktop 1080p", screenSize="1920x1080", platform="Win32", platformVersionLimit=2, timezone="America/New_York" ) # Create custom screen preset custom_screen = client.create_preset( "Custom Resolution", hasCustomScreenSize=True, customScreenWidth=1366, customScreenHeight=768 ) # Create mobile preset mobile_preset = client.create_preset( "iPhone Safari", platform="iPhone", mobileBrowser="SAFARI" ) print(f"Created preset: {proxy_preset['presetName']}") # Get all presets presets = client.get_presets() for preset in presets: print(f"Preset: {preset['presetName']}") # Update preset updated_preset = client.update_preset( proxy_preset['id'], proxyHost="new-proxy.example.com", proxyPort="9050" ) # Create profile from preset preset_data = client.get_preset(desktop_preset['id']) profile = client.create_profile( "Profile from Preset", **preset_data ) # Delete preset client.delete_preset(custom_screen['id']) ``` -------------------------------- ### Change Profile IP Address with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Illustrates how to create a profile with a rotating proxy, start it, change its IP address, and then restart the profile to utilize the new IP. This is useful for scenarios requiring frequent IP rotation. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create profile with rotating proxy profile = client.create_profile( "Rotating IP Profile", useProxy=2, proxyType="http://", proxyHost="rotating-proxy.example.com", proxyPort="8080" ) # Start profile result = client.start_profile(profile['id']) print(f"Initial IP: {result.get('ip')}") # Perform some actions... # ... # Change IP address client.change_profile_ip(profile['id']) print("IP address changed") # Restart profile to use new IP client.stop_profile(profile['id']) result = client.start_profile(profile['id']) print(f"New IP: {result.get('ip')}") ``` -------------------------------- ### Manage Proxies and Get IP Info with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Shows how to check proxy connectivity and retrieve detailed IP geolocation information. It handles potential API errors and requires proxy details such as host, port, type, username, and password. ```python from identory import IdentoryWrapper, APIError client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Check proxy connection try: proxy_result = client.check_proxy( proxy_host="proxy.example.com", proxy_port=8080, proxy_type="http://", username="proxyuser", password="proxypass" ) if proxy_result['success']: print("Proxy connection successful") print(f"Response time: {proxy_result.get('responseTime')}") else: print(f"Proxy failed: {proxy_result.get('error')}") except APIError as e: print(f"Proxy check error: {e}") # Get detailed IP information ip_info = client.get_ip_info( proxy_host="proxy.example.com", proxy_port=8080, proxy_type="socks5://", username="proxyuser", password="proxypass" ) print(f"IP Address: {ip_info.get('ip')}") print(f"Country: {ip_info.get('country')}") print(f"City: {ip_info.get('city')}") print(f"Timezone: {ip_info.get('timezone')}") print(f"ISP: {ip_info.get('isp')}") ``` -------------------------------- ### Integrate Playwright with Identory for Browser Automation Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Connects Playwright to Identory profiles to perform advanced browser automation tasks. It initializes Identory, creates and starts a profile, then connects Playwright using CDP. The snippet demonstrates navigating to a URL, filling forms, submitting credentials, and taking screenshots. ```python import asyncio from identory import IdentoryWrapper from playwright.async_api import async_playwright async def automate_with_playwright(): # Initialize Identory client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create and start profile profile = client.create_profile("Playwright Browser") result = client.start_profile(profile['id'], headless=False) try: # Connect Playwright via CDP playwright = await async_playwright().start() browser = await playwright.chromium.connect_over_cdp( result['browserWSEndpoint'] ) # Get or create context and page context = browser.contexts[0] if browser.contexts else await browser.new_context() page = context.pages[0] if context.pages else await context.new_page() # Perform automation await page.goto('https://example.com', timeout=30000) await page.fill('input[name="username"]', 'testuser') await page.fill('input[name="password"]', 'testpass') await page.click('button[type="submit"]') # Wait for navigation await page.wait_for_load_state('networkidle') # Take screenshot await page.screenshot(path='result.png') # Extract data title = await page.title() print(f"Page title: {title}") # Close browser await browser.close() await playwright.stop() finally: # Always stop the profile client.stop_profile(profile['id']) # Run automation asyncio.run(automate_with_playwright()) ``` -------------------------------- ### Playwright Integration with Identory (Python) Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md This asynchronous Python code demonstrates how to integrate the Identory wrapper with Playwright for browser automation. It includes initializing the Identory client, starting a profile, connecting Playwright to the profile's WebSocket endpoint, navigating a page, performing actions like typing and clicking, taking a screenshot, and finally stopping the profile. ```python import asyncio from identory import IdentoryWrapper from playwright.async_api import async_playwright async def browser_automation(): # Initialize Identory client client = IdentoryWrapper() # Start a profile start_response = client.start_profile( "your-profile-id", headless=False ) # Connect Playwright to the profile playwright = await async_playwright().start() browser = await playwright.chromium.connect_over_cdp(result['browserWSEndpoint']) # Get a new page context = browser.contexts[0] if browser.contexts else await browser.new_context() page = context.pages[0] if context.pages else await context.new_page() # Navigate to a website await page.goto('https://example.com', timeout=30000) # Perform actions await page.keyboard.type('input[name="username"]', 'random-username') await page.keyboard.type('input[name="passwd"]', 'random-password') await page.click('button[type="submit"]') # 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()) ``` -------------------------------- ### Identory Profile Management Operations Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Covers a comprehensive set of profile management operations using the Identory Python wrapper. This includes retrieving, creating, updating, starting, stopping, and deleting profiles, as well as managing cookies and profile settings. ```python # 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"]) ``` -------------------------------- ### Error Handling with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Provides examples of gracefully handling various API errors using the Identory Python wrapper's custom exception types. It covers authentication errors, not found errors, validation errors, rate limiting, and general API errors, demonstrating how to catch and respond to them. ```python from identory import ( IdentoryWrapper, APIError, AuthenticationError, NotFoundError, RateLimitError, ValidationError ) import time client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Handle authentication errors try: invalid_client = IdentoryWrapper( access_token="invalid-token", auto_launch=True ) profiles = invalid_client.get_profiles() except AuthenticationError as e: print(f"Auth failed: {e}") print("Please check your access token") # Handle not found errors try: profile = client.get_profile("non-existent-id") except NotFoundError as e: print(f"Profile not found: {e}") # Handle validation errors try: profile = client.create_profile("") # Empty name except ValidationError as e: print(f"Validation error: {e}") print(f"Details: {e.response_data}") # Handle rate limiting try: for i in range(1000): client.get_profiles() except RateLimitError as e: print(f"Rate limited: {e}") print("Waiting before retry...") time.sleep(60) # Handle general API errors try: result = client.start_profile("some-profile-id") except APIError as e: print(f"API Error {e.status_code}: {e.message}") if e.response_data: print(f"Details: {e.response_data}") ``` -------------------------------- ### Identory Wrapper Client Initialization Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Shows how to initialize the IdentoryWrapper client with various configuration options. This includes setting the access token, controlling automatic launching of the Identory CLI, specifying the base URL and port, and configuring timeouts. ```python from identory import IdentoryWrapper client = IdentoryWrapper( access_token="your-access-token", auto_launch=True, #Default True to auto launch CLI, set False if you handled it in your app base_url="http://127.0.0.1", # Default localhost port=3005, # Default port timeout=30 # Default timeout ) ``` -------------------------------- ### Working with Identory Profiles and Presets (Python) Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md This Python code demonstrates advanced profile management in Identory. It shows how to create a new profile by applying settings from an existing preset using dictionary unpacking and how to perform bulk deletion of multiple profiles by providing a list of their IDs. ```python # 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) ``` -------------------------------- ### Initialize Identory API Client (Python) Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Demonstrates how to initialize the IdentoryWrapper client for interacting with the Identory API. Supports basic and advanced configurations, including automatic CLI service launching and custom base URLs or timeouts. ```python from identory import IdentoryWrapper # Basic initialization with auto-launch client = IdentoryWrapper( access_token="your-access-token-here", auto_launch=True ) # Advanced configuration client = IdentoryWrapper( access_token="your-access-token-here", auto_launch=True, base_url="http://127.0.0.1", port=3005, timeout=30 ) # Manual launch (if you handle CLI service separately) client = IdentoryWrapper( access_token="your-access-token-here", auto_launch=False ) ``` -------------------------------- ### Identory Settings Management Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Demonstrates how to retrieve and set default settings for the Identory platform using the Python wrapper. This includes options for auto-starting profiles and configuring the maximum number of concurrent profiles. ```python # Get default settings settings = client.get_default_settings() # Set default settings client.set_default_settings( autoStartProfiles=False, maxConcurrentProfiles=5 ) ``` -------------------------------- ### Client Initialization Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Initializes the IdentoryWrapper client. This can optionally auto-launch the Identory CLI service. You can configure the access token, base URL, port, and timeout. ```APIDOC ## Client Initialization ### Description Initializes the IdentoryWrapper client. This can optionally auto-launch the Identory CLI service. You can configure the access token, base URL, port, and timeout. ### Method `IdentoryWrapper` constructor ### Parameters - **access_token** (string) - Required - Your Identory API access token. - **auto_launch** (boolean) - Optional (default: `True`) - Whether to automatically launch the Identory CLI service. - **base_url** (string) - Optional (default: `"http://127.0.0.1"`) - The base URL of the Identory service. - **port** (integer) - Optional (default: `3005`) - The port on which the Identory service is running. - **timeout** (integer) - Optional (default: `30`) - The timeout in seconds for API requests. ### Request Example ```python from identory import IdentoryWrapper client = IdentoryWrapper( access_token="your-access-token", auto_launch=True, base_url="http://127.0.0.1", port=3005, timeout=30 ) ``` ``` -------------------------------- ### Manage Default Settings with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Explains how to configure and update default settings for new profiles using the Identory Python wrapper. This includes retrieving current defaults and setting new values for parameters like auto-start, concurrent profiles, timezone, platform, screen size, and proxy usage. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Get current default settings settings = client.get_default_settings() print(f"Current defaults: {settings}") # Update default settings client.set_default_settings( autoStartProfiles=False, maxConcurrentProfiles=5, timezone="UTC", platform="Win32", screenSize="1920x1080", useProxy=0 ) print("Default settings updated") # New profiles will inherit these defaults profile = client.create_profile("New Profile") # This profile will use UTC timezone, Win32 platform, etc. ``` -------------------------------- ### Automate Profile Warmup with Identory Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Automates the process of warming up browser profiles by visiting a list of URLs and performing Google searches. It allows configuration of delay times and scroll actions to simulate user behavior. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) profile = client.create_profile("Warmup Profile") # Define warmup sequence (URLs and search terms) warmup_list = [ "https://www.google.com", "weather forecast", # Google search "https://www.youtube.com", "machine learning tutorials", # Another search "https://www.reddit.com" ] # Configure warmup settings warmup_settings = { "minDelay": 5000, "maxDelay": 15000, "scrollMin": 1, "scrollMax": 3 } # Start warmup result = client.start_profile_warmup( profile['id'], listOfUrls=warmup_list, settings=warmup_settings, skipConnectionCheck=False, enableDebugger=False ) print(f"Warmup started: {result['browserWSEndpoint']}") ``` -------------------------------- ### Bulk Profile Operations with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Demonstrates efficient management of multiple profiles using batch operations provided by the Identory Python wrapper. This covers creating multiple profiles in a loop, collecting their IDs, performing a bulk deletion, and verifying the deletion process. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create multiple profiles profiles = [] for i in range(5): profile = client.create_profile(f"Bulk Profile {i+1}") profiles.append(profile) print(f"Created: {profile['name']} (ID: {profile['id']})") # Collect profile IDs profile_ids = [p['id'] for p in profiles] # Bulk delete profiles client.delete_profiles(profile_ids) print(f"Deleted {len(profile_ids)} profiles") # Verify deletion all_profiles = client.get_profiles() remaining_ids = [p['id'] for p in all_profiles] for pid in profile_ids: assert pid not in remaining_ids, "Profile not deleted" print("Bulk deletion verified") ``` -------------------------------- ### Mobile Profiles for Identory Presets (Python) Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md This Python code demonstrates how to create an Identory preset for mobile browsing. It uses the `create_preset` method, specifying the platform as 'iPhone' and the `mobileBrowser` option as 'SAFARI'. ```python # Create mobile preset mobile_preset = client.create_preset( "Mobile Safari", platform="iPhone", mobileBrowser="SAFARI" ) ``` -------------------------------- ### Manage Identory Presets (Python) Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md This snippet covers the management of Identory presets via the Python wrapper. It shows how to retrieve all presets, create presets with proxy configurations (SOCKS5) or specific screen dimensions and platform settings, update existing presets, and delete presets. ```python # 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") ``` -------------------------------- ### Import and Export Profiles with Identory Python Wrapper Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Demonstrates how to export existing profiles to a zip file and import profiles from a zip file, with an option to override profile attributes during import. Requires an access token and auto_launch enabled. ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Export existing profile profile_id = "00000000-0000-0000-0000-000000000000" export_path = "/backups/profile_backup.zip" result = client.export_profile(profile_id, export_path) print(f"Profile exported to {export_path}") # Import profile import_path = "/backups/profile_backup.zip" imported_profile = client.import_profile(import_path) print(f"Imported profile: {imported_profile['name']} (ID: {imported_profile['id']})") # Import with overrides imported_with_overrides = client.import_profile( import_path, overwrite={ "name": "Imported Profile - Modified", "timezone": "Europe/London", "proxyHost": "new-proxy.example.com" } ) print(f"Imported and modified: {imported_with_overrides['name']}") ``` -------------------------------- ### Settings Management API Source: https://github.com/okoyausman/identory-python-wrapper/blob/main/README.md Endpoints for managing default Identory settings, such as auto-starting profiles and concurrent profile limits. ```APIDOC ## Settings Management ### Get Default Settings #### Description Retrieves the current default settings for the Identory service. #### Method `GET` #### Endpoint `/settings/default` #### Response (Success Response 200) - **settings** (object) - An object containing the default settings. ### Set Default Settings #### Description Sets the default settings for the Identory service. #### Method `POST` #### Endpoint `/settings/default` #### Parameters ##### Request Body - **autoStartProfiles** (boolean) - Optional - Whether profiles should automatically start. - **maxConcurrentProfiles** (integer) - Optional - The maximum number of concurrent profiles allowed. #### Request Example ```json { "autoStartProfiles": false, "maxConcurrentProfiles": 5 } ``` ``` -------------------------------- ### Profile Import and Export Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt This section details how to export existing profiles for backup or transfer and import profiles into the system, with options for overriding existing profile settings. ```APIDOC ## Profile Import and Export ### Description Transfer profiles between systems or create backups. ### Method - `export_profile(profile_id: str, export_path: str)` - `import_profile(import_path: str, overwrite: Optional[Dict] = None)` ### Parameters #### Profile Export - **profile_id** (str) - Required - The ID of the profile to export. - **export_path** (str) - Required - The file path where the profile will be exported. #### Profile Import - **import_path** (str) - Required - The file path from which to import the profile. - **overwrite** (Dict) - Optional - A dictionary of profile fields to override during import. ### Request Example ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Export existing profile profile_id = "00000000-0000-0000-0000-000000000000" export_path = "/backups/profile_backup.zip" result = client.export_profile(profile_id, export_path) print(f"Profile exported to {export_path}") # Import profile import_path = "/backups/profile_backup.zip" imported_profile = client.import_profile(import_path) print(f"Imported profile: {imported_profile['name']} (ID: {imported_profile['id']})") # Import with overrides imported_with_overrides = client.import_profile( import_path, overwrite={ "name": "Imported Profile - Modified", "timezone": "Europe/London", "proxyHost": "new-proxy.example.com" } ) print(f"Imported and modified: {imported_with_overrides['name']}") ``` ### Response #### Success Response (200) - **export_profile**: Returns the path to the exported file on success. - **import_profile**: Returns a dictionary representing the imported profile on success. - **id** (str) - The unique identifier of the imported profile. - **name** (str) - The name of the imported profile. - ... other profile fields ``` -------------------------------- ### Proxy Management Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Manage and verify proxy connections, and retrieve detailed IP geolocation information for analysis. ```APIDOC ## Proxy Management ### Description Check proxy connectivity and retrieve IP geolocation information. ### Method - `check_proxy(proxy_host: str, proxy_port: int, proxy_type: str, username: Optional[str] = None, password: Optional[str] = None)` - `get_ip_info(proxy_host: str, proxy_port: int, proxy_type: str, username: Optional[str] = None, password: Optional[str] = None)` ### Parameters #### Proxy Check/Info - **proxy_host** (str) - Required - The hostname or IP address of the proxy server. - **proxy_port** (int) - Required - The port number of the proxy server. - **proxy_type** (str) - Required - The type of proxy (e.g., "http://", "socks5://"). - **username** (str) - Optional - The username for proxy authentication. - **password** (str) - Optional - The password for proxy authentication. ### Request Example ```python from identory import IdentoryWrapper, APIError client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Check proxy connection try: proxy_result = client.check_proxy( proxy_host="proxy.example.com", proxy_port=8080, proxy_type="http://", username="proxyuser", password="proxypass" ) if proxy_result['success']: print("Proxy connection successful") print(f"Response time: {proxy_result.get('responseTime')}ms") else: print(f"Proxy failed: {proxy_result.get('error')}") except APIError as e: print(f"Proxy check error: {e}") # Get detailed IP information ip_info = client.get_ip_info( proxy_host="proxy.example.com", proxy_port=8080, proxy_type="socks5://", username="proxyuser", password="proxypass" ) print(f"IP Address: {ip_info.get('ip')}") print(f"Country: {ip_info.get('country')}") print(f"City: {ip_info.get('city')}") print(f"Timezone: {ip_info.get('timezone')}") print(f"ISP: {ip_info.get('isp')}") ``` ### Response #### Success Response (200) - **check_proxy**: Returns a dictionary with connection status and response time. - **success** (bool) - Indicates if the proxy connection was successful. - **responseTime** (int) - The time in milliseconds it took to connect. - **error** (str) - Error message if connection failed. - **get_ip_info**: Returns a dictionary with detailed IP information. - **ip** (str) - The IP address. - **country** (str) - The country of the IP address. - **city** (str) - The city of the IP address. - **timezone** (str) - The timezone of the IP address. - **isp** (str) - The Internet Service Provider. #### Error Response (APIError) - **APIError**: Raised for issues during proxy operations. ``` -------------------------------- ### Group Management Source: https://context7.com/okoyausman/identory-python-wrapper/llms.txt Organize profiles into logical groups, assign colors for visual distinction, and manage these groups. ```APIDOC ## Group Management ### Description Organize profiles into logical groups with visual identifiers. ### Method - `create_group(name: str, color: str)` - `get_groups()` - `update_group(group_id: str, name: Optional[str] = None, color: Optional[str] = None)` - `get_group(group_id: str)` ### Parameters #### Group Operations - **name** (str) - Required for `create_group` - The name of the group. - **color** (str) - Required for `create_group` - The color identifier for the group. - **group_id** (str) - Required for `update_group`, `get_group` - The unique ID of the group. ### Request Example ```python from identory import IdentoryWrapper client = IdentoryWrapper(access_token="your-token", auto_launch=True) # Create groups work_group = client.create_group("Work Accounts", "primary") personal_group = client.create_group("Personal Accounts", "info") testing_group = client.create_group("Testing", "warning") print(f"Created group: {work_group['name']} (ID: {work_group['id']})") # Get all groups groups = client.get_groups() for group in groups: print(f"Group: {group['name']} - Color: {group['color']}") # Create profiles in groups work_profile = client.create_profile( "Work Browser 1", groupId=work_group['id'] ) personal_profile = client.create_profile( "Personal Browser", groupId=personal_group['id'] ) # Update group updated_group = client.update_group( work_group['id'], name="Work & Business", color="success" ) # Get specific group group = client.get_group(work_group['id']) print(f"Group details: {group}") ``` ### Response #### Success Response (200) - **create_group**: Returns a dictionary representing the newly created group. - **id** (str) - The unique identifier of the group. - **name** (str) - The name of the group. - **color** (str) - The color associated with the group. - **get_groups**: Returns a list of group dictionaries. - **update_group**: Returns a dictionary representing the updated group. - **get_group**: Returns a dictionary representing the requested group. - **create_profile (with groupId)**: Returns a dictionary representing the profile with the assigned group ID. ```