Skip to content

Commit 7d60cdf

Browse files
authored
Merge pull request #56 from Worvast/master
Fixing Lookup sender cli and changed API responses when failed
2 parents 5c06286 + 9149d01 commit 7d60cdf

File tree

7 files changed

+26
-9
lines changed

7 files changed

+26
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.2.1] - 2019-03-28
8+
#### Fixed
9+
* Lookup shell client now read config correctly
10+
* Lookup shell client now apply default port if empty
11+
12+
#### Changed
13+
* API response in stream mode now return response object if response.code its not 200
14+
715
## [2.2.0] - 2019-02-23
816
#### Changed
917
* Inits args for Sender(), and from_config(), to make it more flexible to config objects and flags

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[![master Build Status](https://travis-ci.com/DevoInc/python-sdk.svg?branch=master)](https://travis-ci.com/DevoInc/python-sdk) [![LICENSE](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/DevoInc/python-sdk/blob/master/LICENSE)
33

4-
[![wheel](https://img.shields.io/badge/wheel-yes-brightgreen.svg)](https://pypi.org/project/devo-sdk/) [![version](https://img.shields.io/badge/version-2.2.0-blue.svg)](https://pypi.org/project/devo-sdk/) [![python](https://img.shields.io/badge/python-2.7%20%7C%203.3%20%7C%203.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-blue.svg)](https://pypi.org/project/devo-sdk/)
4+
[![wheel](https://img.shields.io/badge/wheel-yes-brightgreen.svg)](https://pypi.org/project/devo-sdk/) [![version](https://img.shields.io/badge/version-2.2.1-blue.svg)](https://pypi.org/project/devo-sdk/) [![python](https://img.shields.io/badge/python-2.7%20%7C%203.3%20%7C%203.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-blue.svg)](https://pypi.org/project/devo-sdk/)
55

66

77
# Devo Python SDK

devo/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__description__ = 'Devo Python Library.'
22
__url__ = 'http://www.devo.com'
3-
__version__ = "2.2.0"
3+
__version__ = "2.2.1"
44
__author__ = 'Devo'
55
__author_email__ = 'support@devo.com'
66
__license__ = 'MIT'

devo/api/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ def _make_request(self, payload, stream, verify):
279279
headers=self._get_headers(payload),
280280
verify=verify, timeout=self.timeout,
281281
stream=stream)
282+
if response.status_code != 200:
283+
return response
284+
282285
if stream:
283286
return response.iter_lines()
284287
return response

devo/common/generic/configuration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,14 @@ def get(self, *args, **kwargs):
193193

194194
return self.cfg
195195

196-
def keys(self, prop):
196+
def keys(self, prop=None):
197197
"""Check if exist property and if not then set to None
198198
199199
:param prop: Property to check
200200
"""
201+
if not prop:
202+
return self.cfg.keys()
203+
201204
if prop not in self.cfg:
202205
return False
203206
return True

devo/sender/data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class SenderConfigTCP:
7878
7979
"""
8080

81-
def __init__(self, address=None, port=None, debug=False, timeout=300,
81+
def __init__(self, address=None, port=443, debug=False, timeout=300,
8282
**kwargs):
8383

8484
try:
@@ -216,6 +216,7 @@ def __connect_ssl(self):
216216
cert_reqs=ssl.CERT_NONE)
217217
except ssl.SSLError:
218218
raise ssl.SSLError
219+
219220
self.socket.connect(self._sender_config.address)
220221
self.reconnection += 1
221222
self.logger.debug('Devo-Sender|Conected to %s|%s'

devo/sender/scripts/sender_cli.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def data(**kwargs):
9696
@click.option('--default', '-d', help='Use default file for configuration',
9797
default=False)
9898
@click.option('--url', '--address', '-a', help='Devo relay address')
99-
@click.option('--port', '-p', help='Devo relay address port')
99+
@click.option('--port', '-p', default=443, help='Devo relay address port')
100100
@click.option('--key', help='Devo user key cert file.')
101101
@click.option('--cert', help='Devo user cert file.')
102102
@click.option('--chain', help='Devo chain.crt file.')
@@ -157,16 +157,18 @@ def init_conf(args):
157157
config.load_default_config(section="sender")
158158
finally:
159159
config.mix(dict(args))
160-
return config.get()
160+
return config
161161

162162

163163
def configure_lookup(args):
164164
""" Configuration of Lookup for CLI """
165165
config = init_conf(args)
166-
config.load_config(args.get('config'), 'lookup')
167-
config.mix(dict(args))
166+
if args.get('config'):
167+
config.load_config(args.get('config'), 'lookup')
168+
if "url" in config.keys():
169+
config.set("address", config.get("url"))
168170

169-
return config.get()
171+
return config
170172

171173

172174
def print_error(error, show_help=False, stop=True):

0 commit comments

Comments
 (0)