Metadata-Version: 2.2
Name: py-troya-connect
Version: 0.1.31
Summary: A Python interface for Attachmate Extra Terminal sessions
Home-page: https://github.com/tolgakurtuluss/py-troya-connect
Author: Tolga Kurtulus
Author-email: tolgakurtulus95@gmail.com
Project-URL: Bug Tracker, https://github.com/tolgakurtuluss/py-troya-connect/issues
Project-URL: Documentation, https://github.com/tolgakurtuluss/py-troya-connect/wiki
Project-URL: Source Code, https://github.com/tolgakurtuluss/py-troya-connect
Keywords: terminal,attachmate,extra,automation,thy,turkish airlines
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Topic :: System :: Networking
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pywin32>=223
Requires-Dist: typing-extensions>=4.0.0; python_version < "3.8"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: coverage>=7.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: flake8>=4.0.0; extra == "dev"
Requires-Dist: mypy>=0.900; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# py-troya-connect

Python interface for terminal emulation supporting Attachmate Extra, HIS 2000, and NetManage 3270.

## Installation

```bash
pip install py-troya-connect
```

## Quick Start

```python
from py_troya_connect import ExtraTerminal, TerminalType

# Basic connection
terminal = ExtraTerminal("1")  # Connect to first session
terminal.connect()

# Send a command and read response
terminal.send_command("A10JANISTESB")
screen = terminal.read_screen()
print("\n".join(screen))

terminal.disconnect()
```

## Examples

### 1. Multiple Terminal Types

```python
# Detect and select terminal type
available_types = ExtraTerminal.detect_terminal_type()
terminal = ExtraTerminal("1", terminal_type=TerminalType.HIS)
terminal.connect()
```

### 2. Session Management

```python
# List available sessions
sessions = terminal.list_available_sessions()
print(f"Available sessions: {sessions}")

# Select among terminals listed
terminal = ExtraTerminal("1")

# Check connection status
if terminal.is_connected():
    print("Terminal is connected")
```

### 3. Screen Operations

```python
# Read screen with different options
raw_screen = terminal.read_screen(strip_whitespace=False)
formatted_screen = terminal.read_screen(strip_whitespace=True)

# Wait for specific text
if terminal.wait_for_text("READY", timeout=30):
    print("System is ready")
```

### 4. Command Handling

```python
# Send commands with special keys
terminal.send_command("LOGON USERID{TAB}PASSWORD")
terminal.send_command("CLEAR", wait_for_text="Ready")

# Format commands automatically
terminal.send_command("PF3")  # Automatically adds <ENTER>
```

### 5. Error Handling

```python
from py_troya_connect import ExtraTerminalError, ConnectionError

try:
    terminal = ExtraTerminal("1")
    terminal.connect()
    terminal.send_command("invalid_command")
except ConnectionError as e:
    print(f"Connection failed: {e}")
except ExtraTerminalError as e:
    print(f"Terminal error: {e}")
```

### 6. System Status

```python
# Check system status
terminal = ExtraTerminal("1")
status = terminal.check_system_status()
print(f"Terminal version: {status['Extra Version']}")
print(f"Active sessions: {status['Session Count']}")
```

## Advanced Features

- Multiple terminal type support (Extra, HIS, NetManage)
- Automatic terminal detection
- Robust error handling
- Screen content parsing
- Command formatting
- Session management
- System diagnostics

## Requirements

- Windows OS
- One of the following:
  - Attachmate Extra! Terminal
  - Microsoft HIS 2000
  - NetManage 3270 Client
- Python 3.6+
- pywin32

## License

MIT License
