# Whom Integration Library
Versatile Python library for Whom API integration, supporting multiple systems and web automation drivers.
## 🚀 Features
- **🔌 Multiple Drivers**: Support for Selenium and Playwright
- **🎯 Extensible Systems**: Modular architecture for different systems
- **⚡ Easy to Use**: Simple and intuitive API
- **🛡️ Error Handling**: Custom and robust exceptions
- **📚 Well Documented**: Complete examples and documentation
## 📦 Installation
### Basic Installation
```bash
pip install whom-integration
```
### Installation with Specific Drivers
```bash
# Install with all drivers
pip install "whom-integration[all]"
```
### Development Installation
```bash
# Install with development tools
pip install "whom-integration[dev]"
# Manual installation from source
git clone https://github.com/doc9/whom-integration.git
cd whom-integration
pip install -e .
```
### Driver Setup
After installation, you may need to set up the drivers:
```bash
# For Playwright
playwright install chromium
# For Selenium
# ChromeDriver is usually auto-installed via webdriver-manager
```
## 🎯 Quick Start
### Command Line Interface
The library includes a CLI for quick testing:
```bash
# Test ECAC with Playwright
whom-integration --system ecac --driver playwright --token YOUR_TOKEN --extension YOUR_EXTENSION
# Test PJE with Selenium
whom-integration --system pje --driver selenium --token YOUR_TOKEN --extension YOUR_EXTENSION
# Show help
whom-integration --help
```
### Example with Selenium
```python
from whom_integration import WhomClient, ECACSystem, SeleniumDriver
# Configure client
client = WhomClient(token="your_token", extension_id="your_extension_id")
# Create session
with client.create_session(ECACSystem, SeleniumDriver) as session:
# Authenticate and connect
session.authenticate_and_connect()
# Execute workflow
result = session.execute_workflow("default")
print(f"Success: {result['success']}")
```
### Example with Playwright
```python
from whom_integration import WhomClient, ECACSystem, PlaywrightDriver
client = WhomClient(token="your_token", extension_id="your_extension_id")
with client.create_session(ECACSystem, PlaywrightDriver) as session:
session.authenticate_and_connect()
result = session.execute_workflow("default")
print(f"Success: {result['success']}")
```
## 🏗️ Architecture
### Main Components
```
whom_integration/
├── __init__.py # Main interface
├── core.py # Client and session
├── drivers/ # Automation drivers
│ ├── base.py # Abstract base class
│ ├── selenium_driver.py
│ └── playwright_driver.py
├── systems/ # Supported systems
│ ├── base.py # Abstract base class
│ └── ecac_system.py # ECAC system
│ └── pje_system.py # PJE system
└── exceptions.py # Custom exceptions
```
### Workflow
1. **Whom Client**: Manages API authentication
2. **Driver**: Controls the browser (Selenium/Playwright)
3. **System**: Implements target system specific logic
4. **Session**: Orchestrates the entire process
## 🔧 Configuration
### Basic Configuration
```python
from whom_integration import WhomClient
client = WhomClient(
token="your_token_here",
extension_id="your_extension_id_here",
base_url="https://cloud.doc9.com.br" # Optional
)
```
### Driver Configuration
```python
# Selenium
session = client.create_session(
ECACSystem,
SeleniumDriver,
headless=False,
window_size=(1920, 1080)
)
# Playwright
session = client.create_session(
ECACSystem,
PlaywrightDriver,
headless=False,
viewport={'width': 1920, 'height': 1080}
)
```
## 🎯 **Direct Access to Session Objects**
When you create a session, you have direct access to all available objects and methods:
### 📱 **Driver (Browser)**
```python
# Direct access to configured driver
session.driver.navigate("https://example.com")
session.driver.execute_script("alert('Hello!')")
session.driver.click_element("#button")
session.driver.wait_for_element(".class", timeout=10)
session.driver.get_page_title()
session.driver.get_current_url()
# For Playwright - direct access to page object
if hasattr(session.driver, 'page'):
session.driver.page.fill("#input", "text")
session.driver.page.screenshot(path="screenshot.png")
session.driver.page.pdf(path="page.pdf")
# For Selenium - direct access to driver object
if hasattr(session.driver, 'driver'):
session.driver.driver.find_element(By.ID, "element")
session.driver.driver.execute_script("return document.title")
```
### 🖥️ **System Data**
```python
# System specific methods
redirect_url = session.system.get_redirect_url()
target_url = session.system.get_target_url()
js_commands = session.system.get_js_commands()
cookies = session.system.get_cookies()
# Execute custom workflows
result = session.system.execute_workflow("custom_workflow", param1="value")
```
### 📊 **Session Data**
```python
# Direct access to data returned by API
session_data = session.session_data
# Session cookies
cookies = session_data.get('cookies', [])
# Important URLs
entry_point = session_data.get('entry_point')
redirect_url = session_data.get('redirect')
target_url = session_data.get('url')
# JavaScript commands for execution
js_commands = session_data.get('js', [])
# Allowed domains
allowed_domains = session_data.get('domains', [])
# Elements to hide
hidden_elements = session_data.get('elements_to_hidden', {})
# Extra data
extra_data = session_data.get('extra', {})
```
## 🎯 Supported Systems
### 📊 **Driver Compatibility Table**
| System | Selenium | Playwright | Notes |
|---------|----------|------------|-------|
| **ECAC** | ❌ | ✅ | Federal Revenue System - only works with Playwright |
| **PJE** | ✅ | ❌ | Judiciary System - only works with Selenium |
## 🔄 Changelog
### v1.0.0
- ✅ Initial support for ECAC
- ✅ Initial support for PJE
- ✅ Selenium and Playwright drivers
- ✅ Intelligent proxy system
- ✅ Modular and extensible architecture
- ✅ Complete documentation
Raw data
{
"_id": null,
"home_page": "https://github.com/doc9/whom-integration",
"name": "whom-integration",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Doc9 <cloud@doc9.com.br>",
"keywords": "whom, api, integration, automation, selenium, playwright, ecac, pje, receita-federal, judiciary, web-scraping, browser-automation",
"author": "Doc9",
"author_email": "Doc9 <cloud@doc9.com.br>",
"download_url": "https://files.pythonhosted.org/packages/00/aa/80f3bd29001232b1d710421e33a2a26028e8bb36338a043f8a8436795a30/whom_integration-1.0.1.tar.gz",
"platform": null,
"description": "# Whom Integration Library\n\nVersatile Python library for Whom API integration, supporting multiple systems and web automation drivers.\n\n## \ud83d\ude80 Features\n\n- **\ud83d\udd0c Multiple Drivers**: Support for Selenium and Playwright\n- **\ud83c\udfaf Extensible Systems**: Modular architecture for different systems\n- **\u26a1 Easy to Use**: Simple and intuitive API\n- **\ud83d\udee1\ufe0f Error Handling**: Custom and robust exceptions\n- **\ud83d\udcda Well Documented**: Complete examples and documentation\n\n## \ud83d\udce6 Installation\n\n### Basic Installation\n\n```bash\npip install whom-integration\n```\n\n### Installation with Specific Drivers\n\n```bash\n# Install with all drivers\npip install \"whom-integration[all]\"\n```\n\n### Development Installation\n\n```bash\n# Install with development tools\npip install \"whom-integration[dev]\"\n\n# Manual installation from source\ngit clone https://github.com/doc9/whom-integration.git\ncd whom-integration\npip install -e .\n```\n\n### Driver Setup\n\nAfter installation, you may need to set up the drivers:\n\n```bash\n# For Playwright\nplaywright install chromium\n\n# For Selenium\n# ChromeDriver is usually auto-installed via webdriver-manager\n```\n\n## \ud83c\udfaf Quick Start\n\n### Command Line Interface\n\nThe library includes a CLI for quick testing:\n\n```bash\n# Test ECAC with Playwright\nwhom-integration --system ecac --driver playwright --token YOUR_TOKEN --extension YOUR_EXTENSION\n\n# Test PJE with Selenium\nwhom-integration --system pje --driver selenium --token YOUR_TOKEN --extension YOUR_EXTENSION\n\n# Show help\nwhom-integration --help\n```\n\n### Example with Selenium\n\n```python\nfrom whom_integration import WhomClient, ECACSystem, SeleniumDriver\n\n# Configure client\nclient = WhomClient(token=\"your_token\", extension_id=\"your_extension_id\")\n\n# Create session\nwith client.create_session(ECACSystem, SeleniumDriver) as session:\n # Authenticate and connect\n session.authenticate_and_connect()\n \n # Execute workflow\n result = session.execute_workflow(\"default\")\n \n print(f\"Success: {result['success']}\")\n```\n\n### Example with Playwright\n\n```python\nfrom whom_integration import WhomClient, ECACSystem, PlaywrightDriver\n\n\nclient = WhomClient(token=\"your_token\", extension_id=\"your_extension_id\")\n\nwith client.create_session(ECACSystem, PlaywrightDriver) as session:\n session.authenticate_and_connect()\n result = session.execute_workflow(\"default\")\n print(f\"Success: {result['success']}\")\n\n```\n\n## \ud83c\udfd7\ufe0f Architecture\n\n### Main Components\n\n```\nwhom_integration/\n\u251c\u2500\u2500 __init__.py # Main interface\n\u251c\u2500\u2500 core.py # Client and session\n\u251c\u2500\u2500 drivers/ # Automation drivers\n\u2502 \u251c\u2500\u2500 base.py # Abstract base class\n\u2502 \u251c\u2500\u2500 selenium_driver.py\n\u2502 \u2514\u2500\u2500 playwright_driver.py\n\u251c\u2500\u2500 systems/ # Supported systems\n\u2502 \u251c\u2500\u2500 base.py # Abstract base class\n\u2502 \u2514\u2500\u2500 ecac_system.py # ECAC system\n\u2502 \u2514\u2500\u2500 pje_system.py # PJE system\n\u2514\u2500\u2500 exceptions.py # Custom exceptions\n```\n\n### Workflow\n\n1. **Whom Client**: Manages API authentication\n2. **Driver**: Controls the browser (Selenium/Playwright)\n3. **System**: Implements target system specific logic\n4. **Session**: Orchestrates the entire process\n\n## \ud83d\udd27 Configuration\n\n### Basic Configuration\n\n```python\nfrom whom_integration import WhomClient\n\nclient = WhomClient(\n token=\"your_token_here\",\n extension_id=\"your_extension_id_here\",\n base_url=\"https://cloud.doc9.com.br\" # Optional\n)\n```\n\n### Driver Configuration\n\n```python\n# Selenium\nsession = client.create_session(\n ECACSystem,\n SeleniumDriver,\n headless=False,\n window_size=(1920, 1080)\n)\n\n# Playwright\nsession = client.create_session(\n ECACSystem,\n PlaywrightDriver,\n headless=False,\n viewport={'width': 1920, 'height': 1080}\n)\n```\n\n## \ud83c\udfaf **Direct Access to Session Objects**\n\nWhen you create a session, you have direct access to all available objects and methods:\n\n### \ud83d\udcf1 **Driver (Browser)**\n```python\n# Direct access to configured driver\nsession.driver.navigate(\"https://example.com\")\nsession.driver.execute_script(\"alert('Hello!')\")\nsession.driver.click_element(\"#button\")\nsession.driver.wait_for_element(\".class\", timeout=10)\nsession.driver.get_page_title()\nsession.driver.get_current_url()\n\n# For Playwright - direct access to page object\nif hasattr(session.driver, 'page'):\n session.driver.page.fill(\"#input\", \"text\")\n session.driver.page.screenshot(path=\"screenshot.png\")\n session.driver.page.pdf(path=\"page.pdf\")\n\n# For Selenium - direct access to driver object\nif hasattr(session.driver, 'driver'):\n session.driver.driver.find_element(By.ID, \"element\")\n session.driver.driver.execute_script(\"return document.title\")\n```\n\n### \ud83d\udda5\ufe0f **System Data**\n```python\n# System specific methods\nredirect_url = session.system.get_redirect_url()\ntarget_url = session.system.get_target_url()\njs_commands = session.system.get_js_commands()\ncookies = session.system.get_cookies()\n\n# Execute custom workflows\nresult = session.system.execute_workflow(\"custom_workflow\", param1=\"value\")\n```\n\n### \ud83d\udcca **Session Data**\n```python\n# Direct access to data returned by API\nsession_data = session.session_data\n\n# Session cookies\ncookies = session_data.get('cookies', [])\n\n# Important URLs\nentry_point = session_data.get('entry_point')\nredirect_url = session_data.get('redirect')\ntarget_url = session_data.get('url')\n\n# JavaScript commands for execution\njs_commands = session_data.get('js', [])\n\n# Allowed domains\nallowed_domains = session_data.get('domains', [])\n\n# Elements to hide\nhidden_elements = session_data.get('elements_to_hidden', {})\n\n# Extra data\nextra_data = session_data.get('extra', {})\n```\n\n## \ud83c\udfaf Supported Systems\n\n### \ud83d\udcca **Driver Compatibility Table**\n\n| System | Selenium | Playwright | Notes |\n|---------|----------|------------|-------|\n| **ECAC** | \u274c | \u2705 | Federal Revenue System - only works with Playwright |\n| **PJE** | \u2705 | \u274c | Judiciary System - only works with Selenium |\n\n## \ud83d\udd04 Changelog\n\n### v1.0.0\n- \u2705 Initial support for ECAC\n- \u2705 Initial support for PJE\n- \u2705 Selenium and Playwright drivers\n- \u2705 Intelligent proxy system\n- \u2705 Modular and extensible architecture\n- \u2705 Complete documentation\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library for Whom API integration, supporting multiple systems and web automation drivers",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/doc9/whom-integration/issues",
"Changelog": "https://github.com/doc9/whom-integration/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/doc9/whom-integration#readme",
"Homepage": "https://github.com/doc9/whom-integration",
"Repository": "https://github.com/doc9/whom-integration"
},
"split_keywords": [
"whom",
" api",
" integration",
" automation",
" selenium",
" playwright",
" ecac",
" pje",
" receita-federal",
" judiciary",
" web-scraping",
" browser-automation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "406e3a5b43773397255c9f920c49968e8c2721993ff80257a94b152930beffe8",
"md5": "cb2adc4fad1688ad6a80465fe2125070",
"sha256": "64f6d2ac83020e2e7278d929a64994f28a261b44f9fc2cc7a24d68755bc3af20"
},
"downloads": -1,
"filename": "whom_integration-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cb2adc4fad1688ad6a80465fe2125070",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 18716,
"upload_time": "2025-08-20T15:28:49",
"upload_time_iso_8601": "2025-08-20T15:28:49.460854Z",
"url": "https://files.pythonhosted.org/packages/40/6e/3a5b43773397255c9f920c49968e8c2721993ff80257a94b152930beffe8/whom_integration-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "00aa80f3bd29001232b1d710421e33a2a26028e8bb36338a043f8a8436795a30",
"md5": "ef24c7ad3eca00142b06eabc353fc25e",
"sha256": "3ee4b7ddf58b575666dced211fa847c9446a2afdd9d1f66719bb3963d7e8d2d3"
},
"downloads": -1,
"filename": "whom_integration-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "ef24c7ad3eca00142b06eabc353fc25e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 18024,
"upload_time": "2025-08-20T15:28:50",
"upload_time_iso_8601": "2025-08-20T15:28:50.430771Z",
"url": "https://files.pythonhosted.org/packages/00/aa/80f3bd29001232b1d710421e33a2a26028e8bb36338a043f8a8436795a30/whom_integration-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 15:28:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "doc9",
"github_project": "whom-integration",
"github_not_found": true,
"lcname": "whom-integration"
}