Skip to content

Instantly share code, notes, and snippets.

@openfly
Created February 5, 2018 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openfly/7264aa47e809fe6332ec9102576d0323 to your computer and use it in GitHub Desktop.
Save openfly/7264aa47e809fe6332ec9102576d0323 to your computer and use it in GitHub Desktop.
python-symphony hello world script with named logger.
#!/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