Created
February 5, 2018 18:48
-
-
Save openfly/7264aa47e809fe6332ec9102576d0323 to your computer and use it in GitHub Desktop.
python-symphony hello world script with named logger.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
hello world for symphony w/ logger | |
''' | |
__author__ = 'Matt Joyce' | |
__email__ = 'matt@joyce.nyc' | |
__copyright__ = 'Copyright 2017, Symphony' | |
import logging | |
import symphony | |
logging.getLogger("symphony").setLevel(logging.DEBUG) | |
logging.basicConfig(filename='bot.log', level=logging.DEBUG, format='%(asctime)s %(message)s') | |
def main(): | |
''' main program loop ''' | |
conn = symphony.Config('corp-bot.cfg') | |
# connect to pod | |
try: | |
agent, pod, symphony_sid = conn.connect() | |
print('connected: %s' % symphony_sid) | |
ret = agent.test_echo('test') | |
except Exception as err: | |
print(err) | |
# main loop | |
msgFormat = 'MESSAGEML' | |
message = '<messageML> test </messageML>' | |
# send message | |
try: | |
ret = agent.send_message(symphony_sid, msgFormat, message) | |
print(ret) | |
except Exception as err: | |
print(err) | |
print(agent) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment