From cddfe56ec5405c3174ce2feca7471df75f32d32d Mon Sep 17 00:00:00 2001 From: Reed Feldman Date: Wed, 25 Jul 2018 14:48:10 -0400 Subject: [PATCH] loggin commented --- sym_api_client_python/hello.py => hello.py | 12 ++++++------ setup.py | 2 +- sym_api_client_python/DataFeedEventService.py | 10 +++++----- sym_api_client_python/auth/auth.py | 8 ++++---- sym_api_client_python/clients/DataFeedClient.py | 16 ++++++++-------- sym_api_client_python/clients/MessageClient.py | 14 +++++++------- sym_api_client_python/clients/StreamClient.py | 14 +++++++------- sym_api_client_python/clients/SymBotClient.py | 2 +- sym_api_client_python/clients/UserClient.py | 16 ++++++++-------- sym_api_client_python/clients/apiClient.py | 12 ++++++------ sym_api_client_python/configure/configure.py | 4 ++-- .../listeners/connectionListenerTestImp.py | 2 +- .../listeners/imListenerTestImp.py | 2 +- .../listeners/roomListenerTestImp.py | 2 +- sym_api_client_python/logs/example.log | 6 +++--- 15 files changed, 61 insertions(+), 61 deletions(-) rename sym_api_client_python/hello.py => hello.py (76%) diff --git a/sym_api_client_python/hello.py b/hello.py similarity index 76% rename from sym_api_client_python/hello.py rename to hello.py index 967e8f59..655b6909 100644 --- a/sym_api_client_python/hello.py +++ b/hello.py @@ -1,13 +1,13 @@ -from configure.configure import Config -from auth.auth import Auth -from clients.SymBotClient import SymBotClient -from listeners.imListenerTestImp import IMListenerTestImp -from listeners.roomListenerTestImp import RoomListenerTestImp +from sym_api_client_python.configure.configure import Config +from sym_api_client_python.auth.auth import Auth +from sym_api_client_python.clients.SymBotClient import SymBotClient +from sym_api_client_python.listeners.imListenerTestImp import IMListenerTestImp +from sym_api_client_python.listeners.roomListenerTestImp import RoomListenerTestImp #main() acts as executable script --> run python3 hello.py to start Bot... def main(): print('hi') #pass in path to config.json file to Config class - configure = Config('./resources/config.json') + configure = Config('sym_api_client_python/resources/config.json') #parse through config.json and extract decrypt certificates configure.connect() #if you wish to authenticate using RSA replace following line with: auth = rsa_Auth(configure) --> get rid of auth.authenticate diff --git a/setup.py b/setup.py index 4e077a4d..6a9a8f9a 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ def readme(): setuptools.setup( name="sym_api_client_python", - version="0.0.1", + version="0.0.3", author="Reed Feldman", author_email="reed.feldman@symphony.com", description="Symphony REST API - Python Client", diff --git a/sym_api_client_python/DataFeedEventService.py b/sym_api_client_python/DataFeedEventService.py index 39c1dfa4..fe0cbdad 100644 --- a/sym_api_client_python/DataFeedEventService.py +++ b/sym_api_client_python/DataFeedEventService.py @@ -1,10 +1,10 @@ import json import logging -from listeners import ConnectionListener -from listeners import imListener -from listeners import RoomListener -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from .listeners import ConnectionListener +from .listeners import imListener +from .listeners import RoomListener +# logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) #class handles the the creation and reading of DataFeed #also contains the functionality to dispatch the events coming back from the dataFeed #sends data over to listener where the event is handled diff --git a/sym_api_client_python/auth/auth.py b/sym_api_client_python/auth/auth.py index dc83d2b9..b8f84f54 100644 --- a/sym_api_client_python/auth/auth.py +++ b/sym_api_client_python/auth/auth.py @@ -1,10 +1,10 @@ import json import requests import logging -from clients.apiClient import APIClient -from exceptions.UnauthorizedException import UnauthorizedException -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from ..clients.apiClient import APIClient +from ..exceptions.UnauthorizedException import UnauthorizedException +# logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) class Auth(): #initialize Auth object with config object and empty strings representing auth tokens diff --git a/sym_api_client_python/clients/DataFeedClient.py b/sym_api_client_python/clients/DataFeedClient.py index 2f258df5..9742aff2 100644 --- a/sym_api_client_python/clients/DataFeedClient.py +++ b/sym_api_client_python/clients/DataFeedClient.py @@ -1,14 +1,14 @@ import requests import json -from DataFeedEventService import DataFeedEventService +from ..DataFeedEventService import DataFeedEventService import logging -from clients.apiClient import APIClient -from exceptions.APIClientErrorException import APIClientErrorException -from exceptions.ForbiddenException import ForbiddenException -from exceptions.ServerErrorException import ServerErrorException -from exceptions.UnauthorizedException import UnauthorizedException -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from .apiClient import APIClient +from ..exceptions.APIClientErrorException import APIClientErrorException +from ..exceptions.ForbiddenException import ForbiddenException +from ..exceptions.ServerErrorException import ServerErrorException +from ..exceptions.UnauthorizedException import UnauthorizedException +# logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) #child class of APIClient --> Extends error handling functionality class DataFeedClient(APIClient): diff --git a/sym_api_client_python/clients/MessageClient.py b/sym_api_client_python/clients/MessageClient.py index 7c18e7d4..645ae656 100644 --- a/sym_api_client_python/clients/MessageClient.py +++ b/sym_api_client_python/clients/MessageClient.py @@ -1,13 +1,13 @@ import requests import json import logging -from clients.apiClient import APIClient -from exceptions.APIClientErrorException import APIClientErrorException -from exceptions.ForbiddenException import ForbiddenException -from exceptions.ServerErrorException import ServerErrorException -from exceptions.UnauthorizedException import UnauthorizedException -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from .apiClient import APIClient +from ..exceptions.APIClientErrorException import APIClientErrorException +from ..exceptions.ForbiddenException import ForbiddenException +from ..exceptions.ServerErrorException import ServerErrorException +from ..exceptions.UnauthorizedException import UnauthorizedException +# logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) #child class of APIClient --> Extends error handling functionality #MessageClient class contains a series of functions corresponding to all messaging #endpoints on the REST API. diff --git a/sym_api_client_python/clients/StreamClient.py b/sym_api_client_python/clients/StreamClient.py index f5b0425e..7989dea2 100644 --- a/sym_api_client_python/clients/StreamClient.py +++ b/sym_api_client_python/clients/StreamClient.py @@ -1,13 +1,13 @@ import requests import json import logging -from clients.apiClient import APIClient -from exceptions.APIClientErrorException import APIClientErrorException -from exceptions.ServerErrorException import ServerErrorException -from exceptions.UnauthorizedException import UnauthorizedException -from exceptions.ForbiddenException import ForbiddenException -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from .apiClient import APIClient +from ..exceptions.APIClientErrorException import APIClientErrorException +from ..exceptions.ServerErrorException import ServerErrorException +from ..exceptions.UnauthorizedException import UnauthorizedException +from ..exceptions.ForbiddenException import ForbiddenException +# logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) #child class of APIClient --> Extends error handling functionality #StreamClient class contains a series of functions corresponding to all stream diff --git a/sym_api_client_python/clients/SymBotClient.py b/sym_api_client_python/clients/SymBotClient.py index 4b1d8c8c..d03c16e2 100644 --- a/sym_api_client_python/clients/SymBotClient.py +++ b/sym_api_client_python/clients/SymBotClient.py @@ -1,5 +1,5 @@ from .DataFeedClient import DataFeedClient -from DataFeedEventService import DataFeedEventService +from ..DataFeedEventService import DataFeedEventService from .MessageClient import MessageClient from .StreamClient import StreamClient from .apiClient import APIClient diff --git a/sym_api_client_python/clients/UserClient.py b/sym_api_client_python/clients/UserClient.py index a6c0a7ce..355bf7bd 100644 --- a/sym_api_client_python/clients/UserClient.py +++ b/sym_api_client_python/clients/UserClient.py @@ -1,14 +1,14 @@ import requests import json import logging -from DataFeedEventService import DataFeedEventService -from clients.apiClient import APIClient -from exceptions.APIClientErrorException import APIClientErrorException -from exceptions.ForbiddenException import ForbiddenException -from exceptions.ServerErrorException import ServerErrorException -from exceptions.UnauthorizedException import UnauthorizedException -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from ..DataFeedEventService import DataFeedEventService +from .apiClient import APIClient +from ..exceptions.APIClientErrorException import APIClientErrorException +from ..exceptions.ForbiddenException import ForbiddenException +from ..exceptions.ServerErrorException import ServerErrorException +from ..exceptions.UnauthorizedException import UnauthorizedException +# logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) #child class of APIClient --> Extends error handling functionality #UserClient class contains a series of functions corresponding to all messaging diff --git a/sym_api_client_python/clients/apiClient.py b/sym_api_client_python/clients/apiClient.py index 1499d5a1..771bdcc0 100644 --- a/sym_api_client_python/clients/apiClient.py +++ b/sym_api_client_python/clients/apiClient.py @@ -1,11 +1,11 @@ # from clients import SymBotClient import logging -from exceptions.APIClientErrorException import APIClientErrorException -from exceptions.ServerErrorException import ServerErrorException -from exceptions.UnauthorizedException import UnauthorizedException -from exceptions.ForbiddenException import ForbiddenException -logging.basicConfig(filename='logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) -logging.getLogger("urllib3").setLevel(logging.WARNING) +from ..exceptions.APIClientErrorException import APIClientErrorException +from ..exceptions.ServerErrorException import ServerErrorException +from ..exceptions.UnauthorizedException import UnauthorizedException +from ..exceptions.ForbiddenException import ForbiddenException +# logging.basicConfig(filename='..logs/example.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filemode='w', level=logging.DEBUG) +# logging.getLogger("urllib3").setLevel(logging.WARNING) #error handling class --> take status code and raise appropriate exceptions #this class acts as a parent class to each of the other client class. #each child class extends error handling functionality diff --git a/sym_api_client_python/configure/configure.py b/sym_api_client_python/configure/configure.py index 49171291..ba7c7ce7 100644 --- a/sym_api_client_python/configure/configure.py +++ b/sym_api_client_python/configure/configure.py @@ -1,8 +1,8 @@ import json import requests import sys -from configure.crypt import Crypt -# from ..crypt.crypt import Crypt +# from configure.crypt import Crypt +from ..configure.crypt import Crypt class Config(): #initialize object by passing in config file diff --git a/sym_api_client_python/listeners/connectionListenerTestImp.py b/sym_api_client_python/listeners/connectionListenerTestImp.py index 90fa198b..b51c4879 100644 --- a/sym_api_client_python/listeners/connectionListenerTestImp.py +++ b/sym_api_client_python/listeners/connectionListenerTestImp.py @@ -1,4 +1,4 @@ -from listeners.ConnectionListener import ConnectionListener +from .ConnectionListener import ConnectionListener #sample implementation of Abstract imListener class #has instance of SymBotClient so that it can respond to events coming in by leveraging other clients on SymBotClient diff --git a/sym_api_client_python/listeners/imListenerTestImp.py b/sym_api_client_python/listeners/imListenerTestImp.py index fa7ff489..eb0ad561 100644 --- a/sym_api_client_python/listeners/imListenerTestImp.py +++ b/sym_api_client_python/listeners/imListenerTestImp.py @@ -1,4 +1,4 @@ -from listeners.imListener import IMListener +from .imListener import IMListener #sample implementation of Abstract imListener class #has instance of SymBotClient so that it can respond to events coming in by leveraging other clients on SymBotClient diff --git a/sym_api_client_python/listeners/roomListenerTestImp.py b/sym_api_client_python/listeners/roomListenerTestImp.py index 516eb6b7..1070ea98 100644 --- a/sym_api_client_python/listeners/roomListenerTestImp.py +++ b/sym_api_client_python/listeners/roomListenerTestImp.py @@ -1,4 +1,4 @@ -from listeners.RoomListener import RoomListener +from .RoomListener import RoomListener import calendar; import time; diff --git a/sym_api_client_python/logs/example.log b/sym_api_client_python/logs/example.log index ce35bf25..2383acfe 100644 --- a/sym_api_client_python/logs/example.log +++ b/sym_api_client_python/logs/example.log @@ -1,3 +1,3 @@ -2018-07-24 17:53:30,105 - root - DEBUG - Auth/authenticate() --> needed to authenticate -2018-07-24 17:53:30,106 - root - DEBUG - Auth/get_session_token() -2018-07-24 17:53:30,904 - root - DEBUG - Auth/get_keyauth() +2018-07-24 17:55:40,686 - root - DEBUG - Auth/authenticate() --> needed to authenticate +2018-07-24 17:55:40,686 - root - DEBUG - Auth/get_session_token() +2018-07-24 17:55:41,398 - root - DEBUG - Auth/get_keyauth()