Skip to main content

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


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.315.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_troya_connect-0.1.315-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file py_troya_connect-0.1.315.tar.gz.

File metadata

  • Download URL: py_troya_connect-0.1.315.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

Hashes for py_troya_connect-0.1.315.tar.gz
Algorithm Hash digest
SHA256 52817cb7daac5558dcbd9e5b14d346e55c00aaa7b4048ff9e07491e49d813b32
MD5 409d4bc0e01698cc831eb2cde5a274a9
BLAKE2b-256 9a50e70b2309a1dec61c013c33382689ea23f5a5f3d5b730a3aaa10ed1c91d66

See more details on using hashes here.

File details

Details for the file py_troya_connect-0.1.315-py3-none-any.whl.

File metadata

File hashes

Hashes for py_troya_connect-0.1.315-py3-none-any.whl
Algorithm Hash digest
SHA256 fc4612c3848b1b08e65c7f469fae7f6f39b8389f3ef8ee399e7eee079456d142
MD5 3f554b11a0dbdf15eb1691d20d4b3f11
BLAKE2b-256 2ae1e4a70b2530e986bd01fbba15ffad6c95a6a9a13bad064d925c1c0ab7426a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page