Skip to main content

Exam evaluation and answer display system with SSH verification

Project description

Remote Agent

A minimal Python web app + API built with Bottle for clipboard operations and safe expression evaluation.

Features

  • GET /ping - Health check endpoint returning {pong: "ok"}
  • POST /clipboard - Accepts JSON with content field, stores in memory, and executes xclip command
  • POST /evaluate - Safely evaluates Python literals using ast.literal_eval and stores results
  • GET /answer - Renders HTML showing the latest evaluation result
  • GET /result - Renders HTML showing all evaluation results

Installation

Development Installation

  1. Install dependencies:
pip install bottle
  1. Run the app directly:
python app.py

Package Installation

  1. Build the package:
pip install build
python -m build

This will create dist/remote-agent-0.1.0.tar.gz and wheel files.

  1. Install locally:
pip install dist/remote-agent-0.1.0*.whl
  1. Run using the console script:
remote-agent

The app will start on http://localhost:8080

Publishing to PyPI

Prerequisites

  1. Create accounts:

  2. Install required tools:

pip install build twine

Build and Upload Steps

  1. Update version in pyproject.toml if needed:
version = "0.1.0"
  1. Build the package:
python -m build

This creates:

  • dist/remote-agent-0.1.0.tar.gz (source distribution)
  • dist/remote-agent-0.1.0-py3-none-any.whl (wheel)
  1. Test on TestPyPI first (recommended):
twine upload --repository testpypi dist/*

You'll be prompted for:

  1. Test installation from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ remote-agent
  1. Upload to PyPI (production):
twine upload dist/*

You'll be prompted for:

  1. Verify installation:
pip install remote-agent
remote-agent

Project Structure

.
├── app.py              # Main application
├── __init__.py
├── views/
│   ├── answer.tpl      # Template for latest result
│   └── result.tpl      # Template for all results
├── pyproject.toml      # Package configuration
└── README.md           # This file

API Usage Examples

Health Check

curl http://localhost:8080/ping
# Response: {"pong": "ok"}

Clipboard Operation

curl -X POST http://localhost:8080/clipboard \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello World"}'
# Response: {"status": "ok"}

Evaluate Expression

curl -X POST http://localhost:8080/evaluate \
  -H "Content-Type: application/json" \
  -d '{"expr": "[1, 2, 3]"}'
# Response: {"status": "ok", "result": [1, 2, 3]}

View Results

  • Open http://localhost:8080/answer in browser (latest result)
  • Open http://localhost:8080/result in browser (all results)

Notes

  • Storage is in-memory (data is lost on restart)
  • Evaluation uses ast.literal_eval for safety (only Python literals, no code execution)
  • Clipboard command requires xclip to be installed on the system
  • The app runs on localhost:8080 by default

Requirements

  • Python 3.7+
  • Bottle (only dependency)
  • xclip (for clipboard functionality on Linux)

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

sailor_remote_agent-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

sailor_remote_agent-0.1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file sailor_remote_agent-0.1.1.tar.gz.

File metadata

  • Download URL: sailor_remote_agent-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sailor_remote_agent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 74ea16acc80b91f81250b57b665dc8cfd8ef879ac1310a7f665d44e2ddac9ccf
MD5 c6d72d4f07e4a2a6eabfea24b3b81d74
BLAKE2b-256 ddcc948669a7aa0ad8683acfa0a4990ab5f8182c1e3ff84a327bb66c6d9f0e8b

See more details on using hashes here.

File details

Details for the file sailor_remote_agent-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sailor_remote_agent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d2b7fd037d75e007af2e057037382942342c5f1d84b94e7bce219ae7c62f919
MD5 dc4ad949e1a25729ec798003eedba8cf
BLAKE2b-256 e270087a22817f65be493cc060fc4ffce4c8e447489bc93cf11a93a30f514a64

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