UriPoint
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 and includes a built-in server for serving live endpoints with HTTP method support.
Key Features
Persistent Endpoint Management
UriPoint provides a robust CLI for creating and managing endpoints that persist across sessions.
How It Works
-
Configuration Storage
- Endpoints are stored in
~/.uripoint_config.yaml - Automatically saves and loads endpoint configurations
- Maintains state between CLI sessions
- Endpoints are stored in
-
Endpoint Creation
- Supports multiple creation methods
- Prevents duplicate endpoint registration
- Stores endpoint details with associated metadata
- Configurable HTTP methods
-
Live Server
- Built-in HTTP server for serving endpoints
- Multi-port support
- Protocol-specific handlers
- HTTP method validation
- CORS support
Installation
pip install uripoint
CLI Usage
Endpoint Creation Methods
- 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
- 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
HTTP Method Configuration
Endpoints can be configured to accept specific HTTP methods:
# Example endpoint configuration
endpoints:
"http://localhost:9000/api/users":
response:
users: []
content_type: "application/json"
methods: ["GET", "POST", "PUT", "DELETE"] # Allowed methods
"http://localhost:9000/api/status":
response:
status: "OK"
content_type: "application/json"
methods: ["GET"] # Read-only endpoint
Server Example
Create test endpoints with method configuration:
from uripoint import UriPointCLI
def setup_test_endpoints():
cli = UriPointCLI()
# Create a read-only endpoint
cli.create_endpoint(
uri='http://localhost:9000/api/status',
data={
'response': {'status': 'OK'},
'methods': ['GET']
}
)
# Create a full CRUD endpoint
cli.create_endpoint(
uri='http://localhost:9000/api/users',
data={
'response': {'users': []},
'methods': ['GET', 'POST', 'PUT', 'DELETE']
}
)
setup_test_endpoints()
Then run the server:
# Start the server
uripoint --serve
# Test different methods
curl -X GET http://localhost:9000/api/users
curl -X POST http://localhost:9000/api/users -d '{"name": "John"}'
curl -X PUT http://localhost:9000/api/users/1 -d '{"name": "John Doe"}'
curl -X DELETE http://localhost:9000/api/users/1
# Check allowed methods
curl -X OPTIONS http://localhost:9000/api/users
Supported Protocols
Web Protocols
- HTTP/HTTPS
- RESTful API endpoints
- Method-specific handling (GET, POST, PUT, DELETE, etc.)
- CORS support
- Static file serving
- Proxy support
- See examples/endpoint_demo/
[Rest of protocol documentation remains unchanged...]
Protocol Examples
Each protocol comes with a comprehensive example demonstrating its usage:
# HTTP Example with Methods
from uripoint import UriPointCLI
def setup_http():
cli = UriPointCLI()
cli.create_endpoint(
uri='http://localhost:9000/api/users',
data={
'response': {'users': []},
'methods': ['GET', 'POST', 'PUT', 'DELETE']
}
)
[Rest of examples remain unchanged...]
Configuration File Location
- Path:
~/.uripoint_config.yaml - Format: YAML
- Contents: List of endpoint configurations with method support
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.
Metadata
Release files for uripoint 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uripoint-1.2.0.tar.gz | 33.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uripoint-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.3 kB
Release files / uripoint-1.2.0.tar.gz
| Download URL | uripoint-1.2.0.tar.gz |
|---|---|
| Size | 33.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cfdefad4d252dd9a1ed88c3938ec77055f55b34a1dec5278dd40a33ed45acee
|
|
BLAKE2b-256 checksum How to use checksums |
0c857a21c4a0e6a23ce4bc68bab8b4ad59221713c3f80d75cf699356ae3d0057
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Release files / uripoint-1.2.0-py3-none-any.whl
| Download URL | uripoint-1.2.0-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a987988e9b01f3e39e9480a60c6522ced4f5a58029c57f796576be4da6299d3a
|
|
BLAKE2b-256 checksum How to use checksums |
962d1dc0ded92391591f1f23b5162f759f540da9675f15f7bbb393338581164f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|