Skip to main content

Async Eureka client

Project description

https://img.shields.io/travis/wickedasp/eureka/master.svg?style=flat-square https://img.shields.io/pypi/l/wasp-eureka.svg?style=flat-square https://img.shields.io/pypi/v/wasp-eureka.svg?style=flat-square https://img.shields.io/pypi/status/wasp-eureka.svg?style=flat-square https://img.shields.io/pypi/pyversions/wasp-eureka.svg?style=flat-square

WASP Eureka

Asynchronous Naive Eureka client for the Netflix OSS/Spring Cloud bundled eureka stack.

Installation

Note: this supports Python 3.5+

$ pip install wasp-eureka

If you want to just run it standalone, include those dependencies:

$ pip install wasp-eureka[standalone]

Usage

The surface area of this module is pretty small, effectively you just need to care about the wasp_gateway.EurekaClient class and its methods:

import asyncio

from wasp_gateway import EurekaClient

# no spaces or underscores, this needs to be url-friendly
app_name = 'test-app'

port = 8080
# This needs to be an IP accessible by anyone that
# may want to discover, connect and/or use your service.
ip = '127.0.0.1'
my_eureka_url = 'https://service-discovery.mycompany.com/eureka'
loop = asyncio.get_event_loop()

eureka = EurekaClient(app_name, port, ip, eureka_url=my_eureka_url,
                      loop=loop)

async def main():
    # Presuming you want your service to be available via eureka
    result = await eureka.register()
    assert result, 'Unable to register'

    # You need to provide a heartbeat to renew the lease,
    # otherwise the eureka server will expel the service.
    # The default is 90s, so any time <90s is ok
    while True:
        await asyncio.sleep(67)
        await eureka.renew()

loop.run_until_complete(main(loop=loop))

Creating a Release

Bumpversion provides a simplified way to manage versioning, to check the dry run before running it:

$ bumpversion [patch,minor,major] --dry-run --verbose
$ bumpversion patch

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

wasp-eureka-1.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

wasp_eureka-1.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file wasp-eureka-1.1.0.tar.gz.

File metadata

  • Download URL: wasp-eureka-1.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wasp-eureka-1.1.0.tar.gz
Algorithm Hash digest
SHA256 881221e9d961d13baac65fc329e30aeed4ca96932ca0deb252c3a858a0cda1df
MD5 1adfce6ce7739296fb2273deadaff284
BLAKE2b-256 6f1e0ae3297b92fce77105bccdc0ff5b16f97772dd802dd677927953f98c3302

See more details on using hashes here.

File details

Details for the file wasp_eureka-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wasp_eureka-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46637a2755b08ba4e388684e339d95ddb8efff34900fd0b2a02bcbfc21243cff
MD5 a96b172d9985b2b6c647d47338a4c4d5
BLAKE2b-256 93fe251bea21c8968a04f47bb087eedb462e816f8be8e70a99cf8d0baae5d7fb

See more details on using hashes here.

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