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.314.tar.gz (11.3 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.314-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_troya_connect-0.1.314.tar.gz
  • Upload date:
  • Size: 11.3 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.314.tar.gz
Algorithm Hash digest
SHA256 8030d3b5579150dd5f6d83c3f00316d3a5d4e38918c3ff67acab413c76ea8f7e
MD5 e1ab3fdf507a600de506a4de33c29e35
BLAKE2b-256 8782cad4db16c44bf17eef216c915ff30383654c8fb012c86f0d8b73e1c41ce3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_troya_connect-0.1.314-py3-none-any.whl
Algorithm Hash digest
SHA256 4cdbf80dbd9d5dc7680cb8bd82cb36f425db15544f9788d192d75ee22b6c03f7
MD5 77cd560b20686a5b4a392c2b1bebd813
BLAKE2b-256 01699b803236b6d6e07ff757d0dd106b41cdf0dbc07eb30872b166f0fba7117a

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