This project has been archived by its maintainers, and is no longer receiving any updates.
py-troya-connect
'py-troya-connect' is a Python framework for interacting with Attachmate Extra! X-treme based Troya terminal sessions.
Installation
pip install py-troya-connect
Quick Start
from py_troya_connect import ExtraTerminal
# Interactive session selection
session = ExtraTerminal.select_session()
terminal = ExtraTerminal(session)
terminal.connect()
# Basic screen operations
screen_content = terminal.read_screen()
print(screen_content)
terminal.disconnect()
Key Features
Session Management
# List all available sessions
terminal = ExtraTerminal("1")
sessions = terminal.list_available_sessions()
for session in sessions:
print(f"Session {session['index']}: {session['name']} - {'Connected' if session['connected'] else 'Disconnected'}")
# Interactive session selection
session = ExtraTerminal.select_session()
terminal = ExtraTerminal(session)
Terminal Operations
with ExtraTerminal("1") as terminal:
# Send command with automatic formatting
terminal.send_command("CLEAR") # Automatically adds <ENTER>
# Send complex commands with special keys
terminal.send_command("USER123{TAB}PASS456{ENTER}")
# Read screen content
screen = terminal.read_screen(strip_whitespace=True)
print(screen)
# Wait for specific text to appear
if terminal.wait_for_text("READY", timeout=30):
terminal.send_command("NEXT_COMMAND")
Output Management
from py_troya_connect import ExtraTerminal
# Basic connection
terminal = ExtraTerminal("1") # Connect to first session
terminal.connect()
# Send a command and read response
terminal.send_command("A10JANISTESB")
# First option : Bulk output
screen = terminal.read_screen(strip_whitespace=True)
print(screen)
# Second option : Stripped by row output
screen = terminal.read_screen(strip_whitespace=False)
print(screen)
'strip_whitespace (bool): If True, returns list of stripped lines. If False, returns raw screen content. Defaults to True.'
Error Handling
from py_troya_connect import ExtraTerminalError, ConnectionError, SessionError
try:
terminal = ExtraTerminal("1")
terminal.connect()
except ConnectionError as e:
print(f"Connection failed: {e.message}")
print(f"Error code: {e.error_code}")
print(f"Details: {e.details}")
except SessionError as e:
print(f"Session error: {e.message}")
System Diagnostics
# Check terminal status
terminal = ExtraTerminal("1")
status = terminal.check_system_status()
print(f"Extra Version: {status['Extra Version']}")
print(f"Total Sessions: {status['Session Count']}")
print(f"Available Sessions: {', '.join(status['Available Sessions'])}")
Interactive Usage
# Built-in interactive mode
if __name__ == "__main__":
session = ExtraTerminal.select_session()
with ExtraTerminal(session) as terminal:
while True:
command = input("Enter command (or 'exit'): ")
if command.lower() == 'exit':
break
terminal.send_command(command)
print(terminal.read_screen())
Requirements
- Windows OS
- Attachmate Extra! X-treme terminal
- Python 3.6+
- pywin32
License
MIT License
Metadata
Release files for py-troya-connect 0.1.3152
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_troya_connect-0.1.3152.tar.gz | 10.7 kB | Without provenance | Details for py_troya_connect-0.1.3152.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_troya_connect-0.1.3152-py3-none-any.whl | Python 3 | none | any | Details for py_troya_connect-0.1.3152-py3-none-any.whl |
Total release size: 18.9 kB
Release files / py_troya_connect-0.1.3152.tar.gz
| Download URL | py_troya_connect-0.1.3152.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9d8854f8ec965fc40d1680a917b9677b5319ca8e2097fec2d955d8ed01b40e9
|
|
BLAKE2b-256 checksum How to use checksums |
7f214b76022ce6937954e23396d8ec47dacecdb8e9bf5dffbff30ecdf46c3ccd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Release files / py_troya_connect-0.1.3152-py3-none-any.whl
| Download URL | py_troya_connect-0.1.3152-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86372025680a0988048dd14554d10d866aa16f200ffb2c480f2cb5778c9184dc
|
|
BLAKE2b-256 checksum How to use checksums |
df18bbd863e59232216adcf2a63529107c175e25f649ea33e6c031d6912537d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Security for py-troya-connect 0.1.3152
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.