Skip to content

Commit e740646

Browse files
authored
Merge pull request #50 from DevoInc/release-next
Fix in json processor and improve documentation #49
2 parents 141b455 + 015c0b3 commit e740646

File tree

13 files changed

+82
-47
lines changed

13 files changed

+82
-47
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ 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.1.2] - 2019-02-12
8+
#### Added
9+
* More documentation info and examples
10+
11+
#### Changed
12+
* All new endpoints references for sender and api
13+
14+
#### Fixed
15+
* Problems with proc_json_compact_simple_to_jobj when None
16+
717
## [2.1.1] - 2019-01-29
818
#### Fixed
919
* Problems with recursion depth when zipped send has problems with Socket.

README.md

Lines changed: 9 additions & 7 deletions
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.1.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/)
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.2-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
@@ -15,6 +15,10 @@ This is the SDK to access Devo directly from Python. It can be used to:
1515

1616
The Devo SDK for Python requires Python 2.7+ or Python 3.4+
1717

18+
## Compatibility
19+
- Tested compatibility between python 2.x and 3.x series
20+
- Unit tests for both python 2.x and 3.x
21+
1822
## Quick Start
1923
### Installing the SDK
2024

@@ -52,24 +56,22 @@ You has specific documentation in _[docs](docs)_ folder for each part of SDK:
5256
* [Destination: S3](docs/api/destination_s3.md)
5357

5458

55-
56-
5759
## Contributing
5860
See [PyLibs contributing guide](CONTRIBUTING.md).<br/>
5961
Pull and merge requests are welcome ☺
6062

6163
## Endpoints
6264
##### Sender
6365
To send data with Devo SDK, first choose the required endpoint depending on the region your are accessing from:
64-
* **USA:** us.elb.relay.logtrust.net:443
65-
* **EU:** eu.elb.relay.logtrust.net:443
66+
* **USA:** collector-us.devo.io:443
67+
* **EU:** collector-eu.devo.io:443
6668

6769
You have more information in the official documentation of Devo, [Sending data to Devo](https://docs.devo.com/confluence/ndt/sending-data-to-devo).
6870

6971
##### API
7072
To perform a request with API, first choose the required endpoint depending on the region your are accessing from:
71-
* **USA:** https://api-us.logtrust.com/search/query
72-
* **EU:** https://api-eu.logtrust.com/search/query
73+
* **USA:** https://api-us.devo.com/search/query
74+
* **EU:** https://api-eu.devo.com/search/query
7375

7476
You have more information in the official documentation of Devo, [REST API v2](https://docs.devo.com/confluence/ndt/api-reference/rest-api-v2) .
7577

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.1.1"
3+
__version__ = "2.1.2"
44
__author__ = 'Devo'
55
__author_email__ = 'support@devo.com'
66
__license__ = 'MIT'

devo/api/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
PY3 = sys.version_info[0] > 2
1414
CLIENT_DEFAULT_APP_NAME = 'python-sdk-app'
1515
CLIENT_DEFAULT_USER = 'python-sdk-user'
16-
URL_AWS_EU = 'https://api-eu.logtrust.com'
17-
URL_VDC = 'https://spainapi.logtrust.com'
18-
URL_AWS_USA = 'https://api-us.logtrust.com'
16+
URL_AWS_EU = 'https://api-eu.devo.com'
17+
URL_VDC = 'https://api-es.devo.com'
18+
URL_AWS_USA = 'https://api-us.devo.com'
1919
URL_QUERY_COMPLEMENT = 'search/query'
2020
URL_JOB = '/search/job/'
2121
URL_JOBS = '/search/jobs'

devo/api/processors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ def json_compact_simple_names(data):
5151

5252
def proc_json_compact_simple_to_jobj(names=None):
5353
return proc_json_compact_simple_to_array() if not names else \
54-
lambda data: dict(zip(names, proc_json_compact_simple_to_array()(data)))
54+
lambda data: dict(zip(names,
55+
proc_json_compact_simple_to_array()(data))) \
56+
if data else {}
5557

5658

5759
def proc_json_compact_simple_to_array():
58-
return lambda data: proc_json()(data)['d']
60+
return lambda data: proc_json()(data)['d'] if data else []
5961

6062

6163
def processors():

devo/common/generic/configuration.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def load_yaml(self, path, section=None):
5353
try:
5454
import yaml
5555
except ImportError as import_error:
56-
print(str(import_error), "- Use 'pip install pyyaml' or install this "
56+
print(str(import_error), "- Use 'pip install pyyaml' or "
57+
"install this "
5758
"package with [click] option")
5859
sys.exit(1)
5960
with open(path, 'r') as stream:
@@ -73,7 +74,8 @@ def load_config(self, path, section=None):
7374
if path.endswith('.yaml') or path.endswith('.yml'):
7475
return self.load_yaml(path, section)
7576

76-
raise ConfigurationException("Configuration file type unknown or not supportted: %s" %path)
77+
raise ConfigurationException("Configuration file type unknown "
78+
"or not supported: %s" % path)
7779

7880
def save(self, path=None, save_bak=False):
7981
if path is None:

docs/api/api.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
## Overview
33
This library performs queries to the Client API (Search rest api) of Devo.
44

5+
## Endpoints
6+
##### API
7+
To perform a request with API, first choose the required endpoint depending on the region your are accessing from:
8+
* **USA:** https://api-us.devo.com/search/query
9+
* **EU:** https://api-eu.devo.com/search/query
10+
11+
You have more information in the official documentation of Devo, [REST API v2](https://docs.devo.com/confluence/ndt/api-reference/rest-api-v2) .
512

613
## USAGE
714
#### Constructor
@@ -24,16 +31,16 @@ from devo.api import Client
2431

2532
api = Client(key="myapikey",
2633
secret="myapisecret",
27-
url="https://api-eu.logtrust.com/search/query",
34+
url="https://api-eu.devo.com/search/query",
2835
user="user@devo.com",
2936
app_name="testing app")
3037

3138

3239
api = Client(token="myauthtoken",
33-
url="https://api-eu.logtrust.com/search/query")
40+
url="https://api-eu.devo.com/search/query")
3441

3542
api = Client(jwt="myauthtoken",
36-
url="https://api-eu.logtrust.com/search/query")
43+
url="https://api-eu.devo.com/search/query")
3744
```
3845

3946
#### query() params
@@ -57,17 +64,24 @@ api = Client(jwt="myauthtoken",
5764
###### - Non stream call
5865
- Result of the query in str/bytes when query work
5966
- JSON Object when query has errors
67+
- You can use all the response formats in non-stream mode.
6068
###### - stream call
6169
- Generator with result of the query, str/bytes, when query work
6270
- JSON Object when query has errors
71+
- Stream available formats:
72+
- json/simple
73+
- json/simple/compact
74+
- msgpack
75+
- csv (comma separated values)
76+
- tsv (Tab separated Values)
6377

6478
Normal/Non stream response:
6579
```python
6680
from devo.api import Client
6781

6882
api = Client(key="myapikey",
6983
secret="myapisecret",
70-
url="https://api-eu.logtrust.com/search/query",
84+
url="https://api-eu.devo.com/search/query",
7185
user="user@devo.com",
7286
app_name="testing app")
7387

@@ -85,7 +99,7 @@ from devo.api import Client
8599

86100
api = Client(key="myapikey",
87101
secret="myapisecret",
88-
url="https://api-eu.logtrust.com/search/query",
102+
url="https://api-eu.devo.com/search/query",
89103
user="user@devo.com",
90104
app_name="testing app")
91105

@@ -114,7 +128,7 @@ from devo.api import Client, JSON_SIMPLE
114128

115129
api = Client(key="myapikey",
116130
secret="myapisecret",
117-
url="https://api-eu.logtrust.com/search/query",
131+
url="https://api-eu.devo.com/search/query",
118132
user="user@devo.com",
119133
app_name="testing app")
120134

@@ -238,7 +252,7 @@ json example:
238252
"api": {
239253
"key": "MyAPIkeytoaccessdevo",
240254
"secret": "MyAPIsecrettoaccessdevo",
241-
"url": "https://api-us.logtrust.com/search/query"
255+
"url": "https://api-us.devo.com/search/query"
242256
}
243257
}
244258

@@ -249,7 +263,7 @@ yaml example:
249263
api:
250264
key: "MyAPIkeytoaccessdevo"
251265
secret: "MyAPIsecrettoaccessdevo"
252-
url: "https://api-us.logtrust.com/search/query"
266+
url: "https://api-us.devo.com/search/query"
253267
```
254268
255269
You can use environment variables or a global configuration file for the KEY, SECRET, URL, USER, APP_NAME and COMMENT values
@@ -276,17 +290,16 @@ response = api.query(config['query'],
276290
date_to=config['to'],
277291
response=config['response'])
278292
```
279-
280-
Type allow the following values:
293+
294+
Format allow the following values:
281295

282296
· json
283297
· json/compact
284298
· json/simple
285299
· json/simple/compact
286300
· msgpack
287301
· csv (comma separated values)
288-
· tsv (Tab separated Values)
289-
302+
· tsv (Tab separated Values)
290303

291304
#### Response type JSON
292305

docs/api/destination_email.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ from devo.api import Client
3434

3535
api = Client(key="myapikey",
3636
secret="myapisecret",
37-
url="https://api-eu.logtrust.com/search/query",
37+
url="https://api-eu.devo.com/search/query",
3838
user="user@devo.com",
3939
app_name="testing app")
4040

docs/api/destination_redis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ from devo.api import Client
3636

3737
api = Client(key="myapikey",
3838
secret="myapisecret",
39-
url="https://api-eu.logtrust.com/search/query",
39+
url="https://api-eu.devo.com/search/query",
4040
user="user@devo.com",
4141
app_name="testing app")
4242

docs/api/destination_s3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ from devo.api import Client
2929

3030
api = Client(key="myapikey",
3131
secret="myapisecret",
32-
url="https://api-eu.logtrust.com/search/query",
32+
url="https://api-eu.devo.com/search/query",
3333
user="user@devo.com",
3434
app_name="testing app")
3535

0 commit comments

Comments
 (0)