UriPoint is a comprehensive Python library designed for unified network endpoint management across multiple protocols. It simplifies the creation, management, and monitoring of network endpoints through a single, cohesive interface.
┌─────────────────────────────┐
│ UriPoint Platform │
└─────────────────────────────┘
│
┌──────────────┬────────┴───────┬────────────────┐
▼ ▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Protocol │ │ System │ │ Management │ │ Integration │
│ Layer │ │ Architecture │ │ Tools │ │ Framework │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
Each protocol example would demonstrate the basic usage of that protocol with UriPoint, while the use case examples would show how to combine multiple protocols to build more complex applications. The testing examples would demonstrate how to use UriPoint’s testing framework to ensure reliability and performance.
Individual examples for each supported protocol
Complete examples demonstrating real-world applications
Examples showing how to use UriPoint’s testing framework
examples/
├── server_example.py # Main example server
├── README.md # Examples documentation
├── protocol_examples/ # Protocol-specific examples
│ ├── http_example.py # HTTP/REST API examples
│ ├── streaming_example.py # RTSP, HLS, and DASH streaming examples
│ ├── mqtt_iot_example.py # IoT device communication examples
│ ├── redis_example.py # Data store access examples
│ ├── smtp_example.py # Email handling examples
│ ├── amqp_example.py # Message queuing examples
│ ├── dns_example.py # Domain resolution examples
│ ├── websocket_example.py # WebSocket examples
│ └── ftp_example.py # File transfer examples
├── use_cases/ # Real-world use case examples
│ ├── iot_monitoring/ # IoT monitoring system example
│ │ ├── setup.py
│ │ └── README.md
│ ├── api_gateway/ # API gateway example
│ │ ├── setup.py
│ │ └── README.md
│ ├── streaming_service/ # Streaming service example
│ │ ├── setup.py
│ │ └── README.md
│ └── message_queue/ # Message queue system example
│ ├── setup.py
│ └── README.md
└── testing/ # Testing examples
├── performance_test.py # Performance testing examples
├── integration_test.py # Integration testing examples
├── chaos_test.py # Chaos testing examples
└── protocol_test.py # Protocol-specific testing examples
pip install uripoint
For development:
pip install -r requirements-dev.txt
UriPoint stores configuration in ~/.uripoint_config.yaml
by default, or in the directory specified by the URIPOINT_CONFIG_DIR
environment variable.
# Create an endpoint
uripoint --uri http://localhost:8080/api/users --data '{"response": {"users": []}}' --method GET POST PUT DELETE
# List all configured endpoints
uripoint --list
# Serve all endpoints
uripoint --serve
# Test endpoints
uripoint --test
# Detach specific endpoints
uripoint --detach "http://localhost:9000/api/hello" "http://localhost:9001/metrics"
from uripoint import UriPointCLI
cli = UriPointCLI()
cli.create_endpoint(
uri='http://localhost:8000/api/users',
data={
'response': {'users': []},
'methods': ['GET', 'POST', 'PUT', 'DELETE']
}
)
The repository includes an example server in examples/server_example.py
that demonstrates how to use UriPoint to create mock HTTP endpoints with configurable responses.
pip install .
cd examples
python server_example.py
uripoint --serve
The example creates the following endpoints:
http://localhost:8000/api/hello
: Returns a JSON response with a “message” keyhttp://localhost:8000/api/status
: Returns a JSON response with “status” and “version” keyshttp://localhost:8001/metrics
: Returns a JSON response containing example metrics dataSee examples/protocol_examples/ for comprehensive examples:
UriPoint includes a comprehensive testing framework that ensures reliability and performance across all components:
┌────────────────────────┐ ┌─────────────────────────┐
│ Performance Tests │ │ Integration Tests │
├────────────────────────┤ ├─────────────────────────┤
│ - Endpoint Creation │ │ - Component Interaction │
│ - Concurrent Access │ │ - Multi-Protocol │
│ - Memory Usage │ │ - Process Management │
│ - Protocol Handlers │ │ - Error Propagation │
└────────────────────────┘ └─────────────────────────┘
┌────────────────────────┐ ┌─────────────────────────┐
│ Chaos Tests │ │ Protocol Tests │
├────────────────────────┤ ├─────────────────────────┤
│ - Random Operations │ │ - Protocol Validation │
│ - Process Chaos │ │ - Handler Behavior │
│ - Network Simulation │ │ - Configuration │
│ - Data Input Chaos │ │ - Error Handling │
└────────────────────────┘ └─────────────────────────┘
# Run all tests
pytest tests/
# Run specific test categories
pytest tests/test_protocols.py
pytest tests/test_performance.py
pytest tests/test_integration.py
pytest tests/test_chaos.py
# Run with coverage report
pytest --cov=uripoint tests/
UriPoint is designed for:
┌───────────────────────────────────────────────────────┐
│ UriPoint System │
├───────────────┬──────────────────┬────────────────────┤
│ Core Engine │ Protocol Layer │ Management Layer │
├───────────────┼──────────────────┼────────────────────┤
│ - Config │ - HTTP/HTTPS │ - CLI Interface │
│ - Persistence │ - MQTT │ - API Interface │
│ - Monitoring │ - RTSP │ - Web Dashboard │
│ - Testing │ - Redis │ - Monitoring UI │
└───────────────┴──────────────────┴────────────────────┘
# Python
from uripoint import UriPointCLI
cli = UriPointCLI()
cli.create_endpoint(
uri='http://localhost:8000/api/users',
data={
'response': {'users': []},
'methods': ['GET', 'POST', 'PUT', 'DELETE']
}
)
# CLI & curl
# Create endpoint
uripoint --uri http://localhost:8000/api/users --data '{"response": {"users": []}}' --method GET POST PUT DELETE
# Test endpoint
curl -X GET http://localhost:8000/api/users
# Python
cli.create_endpoint(
uri='mqtt://localhost:1883/sensors/temperature',
data={
'topic': 'sensors/temperature',
'qos': 1,
'device': {
'type': 'temperature',
'location': 'room1'
}
}
)
# Python
cli.create_endpoint(
uri='rtsp://localhost:8554/camera1',
data={
'stream_url': 'rtsp://camera.example.com/stream1',
'transport': 'tcp'
}
)
UriPoint provides a comprehensive solution that goes beyond simple protocol handling, offering a complete platform for building, managing, and operating network communications:
We welcome contributions! See our Contributing Guide for details on:
This document describes the example server provided in the examples/server_example.py
file. This example demonstrates how to use UriPoint to create mock HTTP endpoints with configurable responses.
Install UriPoint:
pip install .
Or, if you are developing, install the development dependencies:
pip install -r requirements-dev.txt
Navigate to the examples
directory:
cd examples
Run the server_example.py
script:
python server_example.py
This script will create the example endpoints and print a message indicating that the server is ready to be started.
Start the UriPoint server:
uripoint --serve
This command will start the UriPoint server and make the defined endpoints accessible.
The example creates the following endpoints:
http://localhost:8000/api/hello
: Returns a JSON response with a “message” key.http://localhost:8000/api/status
: Returns a JSON response with “status” and “version” keys.http://localhost:8001/metrics
: Returns a JSON response containing example metrics data.These endpoints are defined within the setup_test_endpoints
function in server_example.py. The UriPointCLI.create_endpoint
method is used to define each endpoint, specifying the URI and the data to be returned.
The uripoint --serve
command must be run in order to start the server and make the endpoints accessible. The configuration for these endpoints is stored in the .uripoint
directory (or the directory specified by the URIPOINT_CONFIG_DIR
environment variable).
The examples
directory contains the following files:
server_example.py
: Demonstrates how to create mock HTTP endpoints using UriPoint.client_example.py
: Provides an example of how to interact with the endpoints created by server_example.py
.config_example.json
: Contains a sample configuration file for UriPoint.Each file in the examples
directory serves a specific purpose in demonstrating the capabilities of UriPoint. Below is a brief overview of each file:
This script sets up several mock HTTP endpoints using UriPoint. It includes the setup_test_endpoints
function, which defines the endpoints and their responses.
This script demonstrates how to interact with the endpoints created by server_example.py
. It includes examples of making HTTP requests to the endpoints and processing the responses.
This file contains a sample configuration for UriPoint. It can be used as a reference for creating your own configuration files.
Feel free to explore these files to better understand how UriPoint can be used to create and interact with mock HTTP endpoints.