Last active
June 5, 2018 03:07
-
-
Save openfly/2ba2060a3fff3dae67da7586e01806bd to your computer and use it in GitHub Desktop.
A test read datafeed script.
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 | |
''' | |
__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 | |
# send message | |
try: | |
status_code, dfid = agent.create_datafeed() | |
print str(dfid) | |
while(1): | |
status_code, message = agent.read_datafeed(str(dfid)) | |
print str(message) | |
# ret = agent.send_message(symphony_sid, msgFormat, message) | |
# print "%s: %s" % (status_code, retstring) | |
print ret | |
except Exception as err: | |
print err | |
print agent | |
# print(retstring) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment