Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.3] - 2019-01-23
## [2.1.0] - 2019-01-23
#### Changed
* Devo.common get_log() has more flags for better customization

#### Added
* Sender for_logging() creation now verify where is tag flag
* Functions for configuration (save, leng, etc)
* Functions for configuration (save, len, etc)
* Added verify flag for API, for not verify TLS certs

## [2.0.2] - 2019-01-23
#### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[![relese-next Build Status](https://travis-ci.com/DevoInc/python-sdk.svg?branch=release-next)](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)

[![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/)
[![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/)


# Devo Python SDK
Expand Down
2 changes: 1 addition & 1 deletion devo/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__description__ = 'Devo Python Library.'
__url__ = 'http://www.devo.com'
__version__ = "2.0.3"
__version__ = "2.1.0"
__author__ = 'Devo'
__author_email__ = '[email protected]'
__license__ = 'MIT'
Expand Down
20 changes: 12 additions & 8 deletions devo/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def query(self, **kwargs):
if stream
:param kwargs: stream -> if stream or full response
:param kwargs: response -> response format
:param kwargs: verify -> (optional) Either a boolean, in which case
it controls whether we verify
the server's TLS certificate, or a string, in which case it must be
a path to a CA bundle to use. Defaults to ``True``.
:return: Result of the query (dict) or Buffer object
"""

Expand Down Expand Up @@ -216,31 +220,31 @@ def query(self, **kwargs):

return self._call(
self._get_payload(query, query_id, dates, opts),
stream
stream, kwargs.get('verify', True)
)

def _call(self, payload, stream):
def _call(self, payload, stream, verify):
"""
Make the call, select correct item to return
:param payload: item with headers for request
:param stream: boolean, indicate if one call is a streaming call
:return: Response from API
"""
if stream:
return self._return_stream(payload, stream)
return self._return_stream(payload, stream, verify)

response = self._make_request(payload, stream)
response = self._make_request(payload, stream, verify)
if isinstance(response, str):
return proc_json()(response)
return self.processor(response.text)

def _return_stream(self, payload, stream):
def _return_stream(self, payload, stream, verify):
"""If its a stream call, return yield lines
:param payload: item with headers for request
:param stream: boolean, indicate if one call is a streaming call
:return line: yield-generator item
"""
response = self._make_request(payload, stream)
response = self._make_request(payload, stream, verify)

if isinstance(response, str):
yield proc_json()(response)
Expand All @@ -259,7 +263,7 @@ def _return_stream(self, payload, stream):
else:
yield proc_json()(first)

def _make_request(self, payload, stream):
def _make_request(self, payload, stream, verify):
"""
Make the request and control the logic about retries if not internet
:param payload: item with headers for request
Expand All @@ -273,7 +277,7 @@ def _make_request(self, payload, stream):
self.query_url),
data=payload,
headers=self._get_headers(payload),
verify=True, timeout=self.timeout,
verify=verify, timeout=self.timeout,
stream=stream)
if stream:
return response.iter_lines()
Expand Down
3 changes: 3 additions & 0 deletions docs/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ api = Client(jwt="myauthtoken",
- response: response type
- processor: response processor flag from defaults
- comment: Comment for the query
- verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to ``True``.

#### Result returned:
###### - Non stream call
Expand Down