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.311.tar.gz (10.0 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.311-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_troya_connect-0.1.311.tar.gz
  • Upload date:
  • Size: 10.0 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.311.tar.gz
Algorithm Hash digest
SHA256 8891b75b1569ede6c777f4975a9c208155eb1232dc7b6fcbc7e77a3e9c08011a
MD5 244b38a387c0a0b933bf969166ae6302
BLAKE2b-256 31372bac467ef8df1db6505c969ba57f7e94a97ec93bee8e4fb868a0ced02611

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_troya_connect-0.1.311-py3-none-any.whl
Algorithm Hash digest
SHA256 7bf2282feed79120768f7b3358fcad3fc93ee85cf9a1250718497cebc7816f51
MD5 e7d18a98e73b871929ba3576aa23b8a8
BLAKE2b-256 ab4b2072b6c6666ec545d274f400998b7d860fa5bf4888833b6dff9f6fdd642b

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