Skip to main content

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.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

srsrpy-0.2.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file srsrpy-0.2.4.tar.gz.

File metadata

  • Download URL: srsrpy-0.2.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for srsrpy-0.2.4.tar.gz
Algorithm Hash digest
SHA256 e83e70318356fa5587413695f7a718352e214d0b9cac8ca5992e1afe6fb65071
MD5 502fe18cafc5e82dce4c74e79d9e9cac
BLAKE2b-256 ac78c10c3273ccac681a8365892a8c8404717fa9d934905d138428ecdc9f8eeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for srsrpy-0.2.4.tar.gz:

Publisher: srsrpy-release.yml on ifIMust/srsrpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file srsrpy-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: srsrpy-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for srsrpy-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7c89a9d0ed3ee4a6a396c3bed58cf31a539d64c2356f4c8050a44cba7844b857
MD5 b917e8e7d6b9e300bf05e2fa63b2fe03
BLAKE2b-256 a0829801fbb3099a4b63570ea64942a7d9e474f7ae798ae30bba807d0d25a784

See more details on using hashes here.

Provenance

The following attestation bundles were made for srsrpy-0.2.4-py3-none-any.whl:

Publisher: srsrpy-release.yml on ifIMust/srsrpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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