Skip to content

Commit 9f86984

Browse files
Merge pull request #4 from ht-albert/master
Preparing to publish the package
2 parents 09dda6c + f33731d commit 9f86984

26 files changed

+106
-43
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ matrix:
1010
python: 3.6
1111

1212
install:
13-
- pip install -r test-requirements.txt
13+
- pip install -r requirements/test.txt
14+
- pip install -r requirements/sdk.txt
1415

1516
script:
16-
- flake8 connectsdk
17+
- flake8 connect
18+
- pytest

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include requirements/sdk.txt
2+
include connect/logger/config.json
3+
include VERSION

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Connect Python SDK
2-
2+
[![Build Status](https://travis-ci.org/ingrammicro/connect-python-sdk.svg?branch=master)](https://travis-ci.org/ingrammicro/connect-python-sdk)
33
### Getting Started
44
---
55
### Class Features

connect/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import resource
2+
3+
name = 'connect'
4+
5+
__all__ = [
6+
'config',
7+
'resource',
8+
'models',
9+
'logger',
10+
]
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
import json
24
import os
35

@@ -86,9 +88,13 @@ def load_from_file(self, file):
8688
raise TypeError('Invalid config file `{}`\n'
8789
'ERROR: {}'.format(file, str(ex)))
8890

89-
(api_url, api_key, products) = (configs.get('apiEndpoint'),
90-
configs.get('apiKey'),
91-
configs.get('products'))
91+
(api_url, api_key, products) = (configs.get('apiEndpoint', ''),
92+
configs.get('apiKey', ''),
93+
configs.get('products', ''))
94+
95+
products = products.encode('utf-8') if not isinstance(products, (str, list)) else products
96+
api_url = api_url.encode('utf-8') if not isinstance(api_url, str) else api_url
97+
api_key = api_key.encode('utf-8') if not isinstance(api_key, str) else api_key
9298

9399
self.check_credentials(api_url, api_key, products)
94100
self._set_attr(api_url, api_key, products)
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# -*- coding: utf-8 -*-
2+
13
import json
24
import logging
35
import os
46
from logging.config import dictConfig
57

6-
with open(os.path.join(os.path.dirname(__file__), 'config.json'), encoding="utf-8") as config_file:
8+
with open(os.path.join(os.path.dirname(__file__), 'config.json')) as config_file:
79
config = json.load(config_file)
810

911
dictConfig(config['logging'])
@@ -20,4 +22,5 @@ def decorator(self, *args, **kwargs):
2022
logger.debug(
2123
'Function `{}.{}` return: {}'.format(self.__class__.__name__, func.__name__, result))
2224
return result
25+
2326
return decorator

0 commit comments

Comments
 (0)