A Python interface for Attachmate Extra Terminal sessions
Project description
py-troya-connect
'py-troya-connect' is a framework for terminal screen communication between environment and supporting terminals listed below.
- Attachmate Extra! X-treme
- Host Integration Server 2000
- 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(screen)
terminal.disconnect()
Examples
1. Multiple Terminal Types
- Multiple terminal type support (Attachmate Extra! X-treme, Host Integration Server 2000, NetManage 3270)
# Let user see avaliable terminal options
available_types = ExtraTerminal.detect_terminal_type()
available_types
# Choose first possible terminal type with session number 1
terminal = ExtraTerminal("1", terminal_type=available_types[0])
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")
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['Terminal Version']}")
print(f"Active sessions: {status['Session Count']}")
Advanced Features
- Automatic terminal detection
- Robust error handling
- Screen content parsing
- Command formatting
- Session management
- System diagnostics
Requirements
- Windows OS
- One of the following terminals:
- 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
py_troya_connect-0.1.3151.tar.gz
(10.7 kB
view details)
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.3151.tar.gz.
File metadata
- Download URL: py_troya_connect-0.1.3151.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f706f962f220adfa6a20ae2ee72f3e96930530de9d1b2d84743708f59ee51f72
|
|
| MD5 |
02c2553ad7cd18e829efbe7b011448c4
|
|
| BLAKE2b-256 |
265042a2ccbef8868122a468d877a88453d999cfeba508c7cf0b80c1625babb6
|
File details
Details for the file py_troya_connect-0.1.3151-py3-none-any.whl.
File metadata
- Download URL: py_troya_connect-0.1.3151-py3-none-any.whl
- Upload date:
- Size: 8.1 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 |
dd0c18bcbaa82e8ffe1c5377f09ebc3bc57ab31cae2939618071728433ff48ae
|
|
| MD5 |
46451c582ff916cf0395921f3a19237c
|
|
| BLAKE2b-256 |
4c6ee36f4ca58e42aba222f0c5b5924443bf36a41b9f613e16cec0cfd27e28a4
|