Really Simple Service Registry - Python Client
Project description
srsr
Really Simple Service Registry - Python Client
Description
This is the Python client for srsr.
Usage
Typical
from srsrpy import srsrpy
# Store the client object for the lifetime of the service
# If the client's address and port bindings are known, specify:
c = srsrpy.ServiceRegistryClient('http://server.address.com:8080', 'service_name', 'http://client.address.net:3333')
# Alternatively, omit the address and specify the client port only.
# The server will assume http scheme and try to deduce the client IP.
c = srsrpy.ServiceRegistryClient('http://server.address.com:8080', 'service_name', port='3333')
# Returns True if registered. After this point, a thread is active for heartbeats.
success = c.register()
# Carry on with the service duties. Heartbeats will be sent at the default interval.
# At teardown time, deregister
c.deregister()
Example shutdown using interrupt handler
import signal
svc_reg = ServiceRegistryClient('http://server_hostname', 'service_name', 'http://client_hostname')
success = svc_reg.register()
if success:
prev_handler = signal.getsignal(signal.SIGINT)
def handle_sigint(sig, frame):
svc_reg.deregister()
if prev_handler:
prev_handler(sig, frame)
signal.signal(signal.SIGINT, handle_sigint)
Further plans
- Handle failed heartbeat, by stopping the thread.
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
srsrpy-0.2.2.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file srsrpy-0.2.2.tar.gz.
File metadata
- Download URL: srsrpy-0.2.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8515104f123a1fe0b325760b939073a458831f0404fd21e372f7e01a00d34b4c
|
|
| MD5 |
c854a8a4e902af7adf8bd132f2d75775
|
|
| BLAKE2b-256 |
467fa411dfaf41538c5a71713f2a462aff7d6b9812c4c5464b870ade2f9f04e2
|
File details
Details for the file srsrpy-0.2.2-py3-none-any.whl.
File metadata
- Download URL: srsrpy-0.2.2-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
868fddeda37961a349787e2c9238e202b45a3ad0656457cb92aaf664e84fe35e
|
|
| MD5 |
7e45bc40b91b9828f584e30a5024738e
|
|
| BLAKE2b-256 |
ee835fc36010eb8ec8cffec1a62e61db7384b0b1903d56f14d59d6ee5b30d887
|