Skip to main content

A simple web service with file operations and instance management

Project description

aidesk

A simple web service with file operations, authentication and instance management.

Features

  • Web service based on Python's built-in http.server
  • User authentication (login/logout)
  • API endpoint to generate files from text content
  • API endpoint to upload files
  • Instance registration and management
  • CLI to start the service with custom host and port
  • Web interface for API documentation and instance management

Installation

pip install aidesk

Usage

Start the web service:

Default host (localhost) and port (8000)

aidesk

Custom host and port

aidesk --host 0.0.0.0 --port 8080

Debug mode

aidesk --debug

Once the service is running, you can access the API documentation at http://localhost:8000

Default credentials:

  • Username: admin
  • Password: admin

API

Authentication

POST /api/login

Parameters:

  • username: Your username
  • password: Your password

Example: curl -X POST http://localhost:8000/api/login
-d "username=admin&password=admin"

POST /api/logout

Example: curl -X POST http://localhost:8000/api/logout
-b "session_id=your_session_id"

File Operations

POST /api/generate-file (Requires authentication)

Parameters:

  • filename: Name of the file to generate
  • content: Multi-line text content for the file

Example: curl -X POST http://localhost:8000/api/generate-file
-b "session_id=your_session_id"
-d "filename=example.txt&content=First line%0ASecond line%0AThird line"

POST /api/upload-file (Requires authentication)

Parameters:

  • File data as multipart/form-data

Example: curl -X POST http://localhost:8000/api/upload-file
-b "session_id=your_session_id"
-F "file=@localfile.txt"

Instance Management

POST /api/instances/register (No authentication required)

Registers another aidesk instance with this server.

Parameters:

  • hostname: Instance hostname
  • ip: Instance IP address
  • port: Instance port number
  • start_time: Instance start time (ISO format)

Example: curl -X POST http://localhost:8000/api/instances/register
-d "hostname=worker1&ip=192.168.1.100&port=8001&start_time=$(date -Iseconds)"

POST /api/instances/ping (No authentication required)

Updates instance status (heartbeat).

Parameters:

  • instance_id: ID of the instance (format: ip:port)

Example: curl -X POST http://localhost:8000/api/instances/ping
-d "instance_id=192.168.1.100:8001"

GET /api/instances (Requires authentication)

Gets all registered instances.

Example: curl -X GET http://localhost:8000/api/instances
-b "session_id=your_session_id"

DELETE /api/instances/{instance_id} (Requires authentication)

Removes a registered instance.

Example: curl -X DELETE http://localhost:8000/api/instances/192.168.1.100:8001
-b "session_id=your_session_id"

Web Interface

License

MIT

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

aidesk-0.2a0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

aidesk-0.2a0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file aidesk-0.2a0.tar.gz.

File metadata

  • Download URL: aidesk-0.2a0.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for aidesk-0.2a0.tar.gz
Algorithm Hash digest
SHA256 5a8a0dcd4e83afec1ec96364dbe60721477ad8aa585b19ad47e3c0fc9ff1f1e0
MD5 f63d13d6b2b2c7b22d7e3b5cfa71bf72
BLAKE2b-256 985bd95c2d3f08d1f675ab02f7ec216bb5f3e6333bbaf17af975fff2d38d4c3d

See more details on using hashes here.

File details

Details for the file aidesk-0.2a0-py3-none-any.whl.

File metadata

  • Download URL: aidesk-0.2a0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for aidesk-0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff569728e354c37a5e046d42971f79da0cbba33c0adde3b4f751456f6b1042aa
MD5 23cfa7bb76cc1b5d883a7864ceaae71f
BLAKE2b-256 2b3e7de75d6acc68d1aa9952fd3752c52c5c7b6ae6cac7ecffb4800904793a5d

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