forked from JiqiD-Tek/eureka
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
41 lines (29 loc) · 743 Bytes
/
Copy pathtest.py
File metadata and controls
41 lines (29 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
# File @ test.py
# Create @ 2017/8/11 15:59
# Author @ 819070918@qq.com
from __future__ import with_statement
from eureka import DiscoveryClient
app = 'EUREKA_TEST'
eureka_urls = ['http://localhost:8761', ]
instance = {
'ipAddr': 'localhost',
'port': 7777,
'app': app,
'instanceId': 'instanceId',
'leaseInfo': {
'durationInSecs': 10,
'evictionDurationInSecs': 20,
}
}
client = DiscoveryClient(eureka_urls, instance)
# registering service
client.register()
# Fetching all app data
applications = client.get_applications()
print applications
# Fetching app data
app_data = client.get_application(app)
print app_data
# unregister service
client.unregister()