Skip to content

Commit 5d230b2

Browse files
authored
Merge pull request #45 from DevoInc/release-next
Added flag revise to api query, for make insecure calls if client need it
2 parents 079e8e6 + 2c98e7a commit 5d230b2

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +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.0.3] - 2019-01-23
7+
## [2.1.0] - 2019-01-23
88
#### Changed
99
* Devo.common get_log() has more flags for better customization
1010

1111
#### Added
1212
* Sender for_logging() creation now verify where is tag flag
13-
* Functions for configuration (save, leng, etc)
13+
* Functions for configuration (save, len, etc)
14+
* Added verify flag for API, for not verify TLS certs
1415

1516
## [2.0.2] - 2019-01-23
1617
#### Fixed

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.0.3-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.1.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/)
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.0.3"
3+
__version__ = "2.1.0"
44
__author__ = 'Devo'
55
__author_email__ = 'support@devo.com'
66
__license__ = 'MIT'

devo/api/client.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ def query(self, **kwargs):
181181
if stream
182182
:param kwargs: stream -> if stream or full response
183183
:param kwargs: response -> response format
184+
:param kwargs: verify -> (optional) Either a boolean, in which case
185+
it controls whether we verify
186+
the server's TLS certificate, or a string, in which case it must be
187+
a path to a CA bundle to use. Defaults to ``True``.
184188
:return: Result of the query (dict) or Buffer object
185189
"""
186190

@@ -216,31 +220,31 @@ def query(self, **kwargs):
216220

217221
return self._call(
218222
self._get_payload(query, query_id, dates, opts),
219-
stream
223+
stream, kwargs.get('verify', True)
220224
)
221225

222-
def _call(self, payload, stream):
226+
def _call(self, payload, stream, verify):
223227
"""
224228
Make the call, select correct item to return
225229
:param payload: item with headers for request
226230
:param stream: boolean, indicate if one call is a streaming call
227231
:return: Response from API
228232
"""
229233
if stream:
230-
return self._return_stream(payload, stream)
234+
return self._return_stream(payload, stream, verify)
231235

232-
response = self._make_request(payload, stream)
236+
response = self._make_request(payload, stream, verify)
233237
if isinstance(response, str):
234238
return proc_json()(response)
235239
return self.processor(response.text)
236240

237-
def _return_stream(self, payload, stream):
241+
def _return_stream(self, payload, stream, verify):
238242
"""If its a stream call, return yield lines
239243
:param payload: item with headers for request
240244
:param stream: boolean, indicate if one call is a streaming call
241245
:return line: yield-generator item
242246
"""
243-
response = self._make_request(payload, stream)
247+
response = self._make_request(payload, stream, verify)
244248

245249
if isinstance(response, str):
246250
yield proc_json()(response)
@@ -259,7 +263,7 @@ def _return_stream(self, payload, stream):
259263
else:
260264
yield proc_json()(first)
261265

262-
def _make_request(self, payload, stream):
266+
def _make_request(self, payload, stream, verify):
263267
"""
264268
Make the request and control the logic about retries if not internet
265269
:param payload: item with headers for request
@@ -273,7 +277,7 @@ def _make_request(self, payload, stream):
273277
self.query_url),
274278
data=payload,
275279
headers=self._get_headers(payload),
276-
verify=True, timeout=self.timeout,
280+
verify=verify, timeout=self.timeout,
277281
stream=stream)
278282
if stream:
279283
return response.iter_lines()

docs/api/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ api = Client(jwt="myauthtoken",
4949
- response: response type
5050
- processor: response processor flag from defaults
5151
- comment: Comment for the query
52+
- verify: (optional) Either a boolean, in which case it controls whether we verify
53+
the server's TLS certificate, or a string, in which case it must be a path
54+
to a CA bundle to use. Defaults to ``True``.
5255

5356
#### Result returned:
5457
###### - Non stream call

0 commit comments

Comments
 (0)