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
c = srsrpy.ServiceRegistryClient('http://server.address.com:8080', 'service_name', 'http://client.address.net:3333')
# Returns True if registered
success = c.register()
# Carry on with the service duties. Heartbeats will be sent at the default interval.
# At teardown time, deregister
c.deregister()
Shutdown using interrupt handler
import signal
try:
svc_reg = ServiceRegistryClient('http://server_hostname', 'service_name', 'http://client_hostname')
svc_reg.register()
# Assume registration was successful. Deregister on Ctrl-C
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)
except:
print("Couldn't connect to registry server.")
Further plans
- Publish the client to the PyPI production server
- 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.0.tar.gz
(3.9 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.0.tar.gz.
File metadata
- Download URL: srsrpy-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a168e8b9971aeb5947d9954913b4030239a41e5ba7ff6812e424e452451f74ae
|
|
| MD5 |
9eb1804e50dd8cf091181cb85301403e
|
|
| BLAKE2b-256 |
d4f0ea318bbc1143e2d46d14cb55c3135d828fa879fa5f9c1e31fd4193b5ffe0
|
File details
Details for the file srsrpy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: srsrpy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
210f9afa7822ddb95f1442cd15db5838c4ebdcec9854b40d65bd517459e076f0
|
|
| MD5 |
3824ab7b7e99c4263b8385382567c411
|
|
| BLAKE2b-256 |
e8c60ef5041317c25900b276e8afa433b405a3c0ac8072e4766d9f26012c0b7c
|