Skip to main content

A flexible Python library for endpoint management and URI processing

Project description

UriPoint

Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                      UriPoint System                        │
├──────────────────┬───────────────────┬──────────────────────┤
│   CLI Interface  │ Protocol Handlers │   Endpoint Manager   │
├──────────────────┴───────────────────┴──────────────────────┤
│                                                             │
│  ┌─────────────┐   ┌─────────────┐   ┌─────────────┐        │
│  │   HTTP(S)   │   │    MQTT     │   │    RTSP     │        │
│  │  Endpoints  │   │  Endpoints  │   │  Endpoints  │        │
│  └─────────────┘   └─────────────┘   └─────────────┘        │
│                                                             │
│  ┌─────────────┐   ┌─────────────┐   ┌─────────────┐        │
│  │   Redis     │   │    SMTP     │   │    AMQP     │        │
│  │  Endpoints  │   │  Endpoints  │   │  Endpoints  │        │
│  └─────────────┘   └─────────────┘   └─────────────┘        │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Overview

UriPoint is a flexible Python library for creating, managing, and interacting with network endpoints across multiple protocols. It provides a unified interface for handling various communication protocols, including streaming protocols (RTSP, HLS, DASH) and IoT protocols (MQTT).

Key Features

Persistent Endpoint Management

UriPoint provides a robust CLI for creating and managing endpoints that persist across sessions.

How It Works

  1. Configuration Storage

    • Endpoints are stored in ~/.uripoint_config.yaml
    • Automatically saves and loads endpoint configurations
    • Maintains state between CLI sessions
  2. Endpoint Creation

    • Supports multiple creation methods
    • Prevents duplicate endpoint registration
    • Stores endpoint details with associated metadata
    • Configurable HTTP methods
  3. Live Server

    • Built-in HTTP server for serving endpoints
    • Multi-port support
    • Protocol-specific handlers
    • HTTP method validation
    • CORS support

Protocol Support

┌─────────────────────────┐  ┌─────────────────────────┐
│     Web Protocols       │  │    Streaming Protocols  │
├─────────────────────────┤  ├─────────────────────────┤
│ - HTTP/HTTPS            │  │ - RTSP                  │
│ - WebSocket (WS/WSS)    │  │ - HLS                   │
│ - GraphQL               │  │ - DASH                  │
└─────────────────────────┘  └─────────────────────────┘

┌─────────────────────────┐  ┌─────────────────────────┐
│    Storage Protocols    │  │   Messaging Protocols   │
├─────────────────────────┤  ├─────────────────────────┤
│ - Redis                 │  │ - MQTT                  │
│ - FTP/SFTP              │  │ - AMQP                  │
│ - File System           │  │ - SMTP                  │
└─────────────────────────┘  └─────────────────────────┘

Installation

pip install uripoint

CLI Usage

Development Flow

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Create    │     │   Configure │     │    Serve    │
│  Endpoint   │ ──► │   Protocol  │ ──► │  Endpoint   │
└─────────────┘     └─────────────┘     └─────────────┘
       │                                       │
       │                                       │
       ▼                                       ▼
┌─────────────┐                         ┌─────────────┐
│    Test     │ ◄─────────────────────  │   Monitor   │
│  Endpoint   │                         │   Status    │
└─────────────┘                         └─────────────┘

Command Structure

uripoint [options] <command>
┌────────────────────────────────────────────────────┐
│ Commands:                                          │
├────────────────────────────────────────────────────┤
│ --uri      Define endpoint URI                     │
│ --method   Specify HTTP methods                    │
│ --data     Configure endpoint data                 │
│ --serve    Start serving endpoints                 │
│ --list     Show configured endpoints               │
│ --detach   Remove endpoints                        │
└────────────────────────────────────────────────────┘

Endpoint Creation Methods

  1. Full URI Approach with HTTP Methods
# Create an endpoint with full URI and specific HTTP methods
uripoint --uri http://localhost:8080/api/users --data '{"response": {"status": "OK"}}' --method GET POST PUT
  1. Component-Based Approach
# Create an endpoint using individual components
uripoint --hostname localhost --path /api/status --protocol http --port 8001 --data '{"status": "OK"}' --method GET

Endpoint Management

# List all configured endpoints
uripoint --list

# Serve all endpoints as a live server
uripoint --serve

# Test endpoints
uripoint --test

# Detach specific endpoints
uripoint --detach "http://localhost:9000/api/hello" "http://localhost:9001/metrics"

# Detach all endpoints
uripoint --detach

Protocol Examples

Streaming Protocols

RTSP Example

from uripoint import UriPointCLI

# Create RTSP endpoint for security camera
cli = UriPointCLI()
cli.create_endpoint(
    uri='rtsp://localhost:8554/camera1',
    data={
        'stream_url': 'rtsp://camera.example.com/stream1',
        'transport': 'tcp',
        'auth': {
            'username': 'admin',
            'password': 'secure123'
        }
    }
)

HLS Example

# Create HLS endpoint for live streaming
cli.create_endpoint(
    uri='http://localhost:8080/live/stream.m3u8',
    data={
        'manifest_url': '/live/stream.m3u8',
        'segment_duration': 6,
        'options': {
            'bandwidth_variants': [
                {'resolution': '1080p', 'bitrate': 5000000},
                {'resolution': '720p', 'bitrate': 2500000}
            ]
        }
    }
)

DASH Example

# Create DASH endpoint for video on demand
cli.create_endpoint(
    uri='http://localhost:8080/vod/manifest.mpd',
    data={
        'mpd_url': '/vod/manifest.mpd',
        'segment_duration': 4,
        'options': {
            'quality_levels': [
                {'resolution': '2160p', 'bitrate': 15000000},
                {'resolution': '1080p', 'bitrate': 4500000}
            ]
        }
    }
)

IoT Protocols

MQTT Example

# Create MQTT endpoint for temperature sensor
cli.create_endpoint(
    uri='mqtt://localhost:1883/sensors/temperature',
    data={
        'topic': 'sensors/temperature',
        'qos': 1,
        'retain': True,
        'device': {
            'id': 'temp_sensor_01',
            'type': 'temperature',
            'location': 'living_room'
        }
    }
)

# Create MQTT endpoint for smart light control
cli.create_endpoint(
    uri='mqtt://localhost:1883/devices/lights',
    data={
        'topic': 'devices/lights',
        'qos': 1,
        'retain': True,
        'device': {
            'id': 'smart_light_01',
            'capabilities': ['dimming', 'color']
        }
    }
)

See examples/protocol_examples/ for more comprehensive examples:

Supported Protocols

Streaming Protocols

  • RTSP

    • Security camera streams
    • Live video feeds
    • Transport options (TCP/UDP)
    • Authentication support
  • HLS (HTTP Live Streaming)

    • Live streaming
    • Video on demand
    • Adaptive bitrate
    • Multiple quality variants
  • DASH (Dynamic Adaptive Streaming over HTTP)

    • Video on demand
    • Live streaming
    • Multiple quality levels
    • Multi-language support

IoT and Messaging Protocols

  • MQTT
    • IoT device communication
    • QoS levels
    • Retain messages
    • Topic-based routing
    • Device management

Web Protocols

  • HTTP/HTTPS
    • RESTful API endpoints
    • Method-specific handling
    • CORS support
    • Static file serving

Data Store Protocols

  • Redis
    • Caching and data storage
    • Multiple database support
    • Key expiration

Email Protocols

  • SMTP
    • Email sending capabilities
    • HTML and plain text support
    • Template system
    • Attachments handling

Message Queue Protocols

  • AMQP (RabbitMQ)
    • Message queuing
    • Exchange types
    • Routing capabilities
    • Durable queues

Domain Name Protocols

  • DNS
    • Forward and reverse lookups
    • Multiple record types
    • DNS monitoring
    • Caching support

Configuration File Location

  • Path: ~/.uripoint_config.yaml
  • Format: YAML
  • Contents: List of endpoint configurations

Contributing

Contributions are welcome! Please see CONTRIBUTING.md

License

This project is licensed under the terms of the LICENSE file in the project root.

Changelog

See CHANGELOG.md for version history and updates.

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

uripoint-1.4.0.tar.gz (43.5 kB view details)

Uploaded Source

Built Distribution

uripoint-1.4.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file uripoint-1.4.0.tar.gz.

File metadata

  • Download URL: uripoint-1.4.0.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for uripoint-1.4.0.tar.gz
Algorithm Hash digest
SHA256 0b96a5c80d7930f9888a0f442058cdeab1ccf05886426461469c55929ff41b4d
MD5 c8bd7fb85d910b6b426f0d24fceb417b
BLAKE2b-256 3443149db05a2d0bfea0a86a51826aa11af6b6e044369883e4a6ba26ce30eab6

See more details on using hashes here.

File details

Details for the file uripoint-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: uripoint-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for uripoint-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 edbb02666ac70c0f35cbcb2d65b1071f9d22cbcadc4e0abd9600c34d8667d36d
MD5 3e7bab275e620f382c5f4eadf48f52e1
BLAKE2b-256 6d10153b454aefb92f3d1d246910fcbdf12651ea1d440f5ac1cf8337e875d0db

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page