A Python interface for Attachmate Extra Terminal sessions
Project description
py-troya-connect
Python interface for terminal emulation supporting Attachmate Extra, HIS 2000, and NetManage 3270.
Installation
pip install py-troya-connect
Quick Start
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
# Detect and select terminal type
available_types = ExtraTerminal.detect_terminal_type()
terminal = ExtraTerminal("1", terminal_type=TerminalType.HIS)
terminal.connect()
2. Session Management
# 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
# 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
# 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
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
# 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
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 py_troya_connect-0.1.31.tar.gz.
File metadata
- Download URL: py_troya_connect-0.1.31.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8a9925d182d1bb7274d4ccdc1693c2fac722eb10c1fb8cff60c66e689650f73
|
|
| MD5 |
b43f54ceb39b919a9eb78c354357e317
|
|
| BLAKE2b-256 |
263541132d02de49d35f092f93047ae35c16584b6f598ae52de7403010a3c69f
|
File details
Details for the file py_troya_connect-0.1.31-py3-none-any.whl.
File metadata
- Download URL: py_troya_connect-0.1.31-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec1109db3209e9d99f58217de2d67d1179aa96bb647357d43c0eba4c681f256c
|
|
| MD5 |
ed32475032cd7a9b74bc3726fb92ebff
|
|
| BLAKE2b-256 |
89bfa86633f5b1419d300bbb58fd02d65efe48d77ff2af4b43eacad9e91f5fd8
|