Last active
May 31, 2018 17:15
-
-
Save openfly/a6c7249dbfdb7b21fd638cdfeb0aea85 to your computer and use it in GitHub Desktop.
test run of hello_world.py for python-symphony module
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
matt.joyce@prometheus ~/SYMPHONY/OSS/test virtualenv EXAMPLE-OSS | |
New python executable in /Users/matt.joyce/SYMPHONY/OSS/test/EXAMPLE-OSS/bin/python | |
Installing setuptools, pip, wheel...done. | |
matt.joyce@prometheus ~/SYMPHONY/OSS/test source EXAMPLE-OSS/bin/activate | |
(EXAMPLE-OSS) matt.joyce@prometheus ~/SYMPHONY/OSS/test | |
(EXAMPLE-OSS) matt.joyce@prometheus ~/SYMPHONY/OSS/test pip install --upgrade python-symphony | |
Collecting python-symphony | |
Downloading https://files.pythonhosted.org/packages/3a/4c/95a8c67cd098494690ad872b644e4a5071fbc9b6a1b4835d8b7a0ea4df78/python-symphony-0.2.6.tar.gz | |
Requirement not upgraded as not directly required: pip in ./EXAMPLE-OSS/lib/python2.7/site-packages (from python-symphony) (10.0.1) | |
Collecting requests (from python-symphony) | |
Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl | |
Collecting python-symphony-binding==0.0.11 (from python-symphony) | |
Downloading https://files.pythonhosted.org/packages/04/8a/aea91e378af26d7320af1c9a29f5519beaf462dd07aca806de29f5cb1599/python-symphony-binding-0.0.11.tar.gz | |
Collecting pytz (from python-symphony) | |
Using cached https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl | |
Collecting lxml (from python-symphony) | |
Downloading https://files.pythonhosted.org/packages/18/95/abf8204fbbc9a01e0e156029cd1ee974237b5798b9e84477df6c4fabfbd2/lxml-4.2.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (8.8MB) | |
100% |████████████████████████████████| 8.8MB 1.1MB/s | |
Collecting configparser (from python-symphony) | |
Collecting bs4 (from python-symphony) | |
Downloading https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz | |
Collecting pyopenssl (from python-symphony) | |
Downloading https://files.pythonhosted.org/packages/96/af/9d29e6bd40823061aea2e0574ccb2fcf72bfd6130ce53d32773ec375458c/pyOpenSSL-18.0.0-py2.py3-none-any.whl (53kB) | |
100% |████████████████████████████████| 61kB 2.1MB/s | |
Collecting httpretty (from python-symphony) | |
Collecting idna<2.7,>=2.5 (from requests->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl | |
Collecting urllib3<1.23,>=1.21.1 (from requests->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl | |
Collecting certifi>=2017.4.17 (from requests->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl | |
Collecting chardet<3.1.0,>=3.0.2 (from requests->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl | |
Collecting bravado (from python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/d5/ae/30fd7c73923e77c368f3b1e14fae46152b1099e0427b245c0ad998f24991/bravado-9.2.2-py2.py3-none-any.whl | |
Collecting beautifulsoup4 (from bs4->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/a6/29/bcbd41a916ad3faf517780a0af7d0254e8d6722ff6414723eedba4334531/beautifulsoup4-4.6.0-py2-none-any.whl (86kB) | |
100% |████████████████████████████████| 92kB 6.0MB/s | |
Collecting six>=1.5.2 (from pyopenssl->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl | |
Collecting cryptography>=2.2.1 (from pyopenssl->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/58/c1/23bea66007d4be75ce02056fac665f9a207535e89fb3c7931420fa4a5f57/cryptography-2.2.2-cp27-cp27m-macosx_10_6_intel.whl | |
Collecting bravado-core>=4.11.0 (from bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/6a/4c/a362450d959339b41a046a519eac806715fd7186453085df969fb23d2d8e/bravado_core-5.0.1-py2.py3-none-any.whl (52kB) | |
100% |████████████████████████████████| 61kB 8.9MB/s | |
Collecting python-dateutil (from bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB) | |
100% |████████████████████████████████| 215kB 2.4MB/s | |
Collecting pyyaml (from bravado->python-symphony-binding==0.0.11->python-symphony) | |
Collecting msgpack-python (from bravado->python-symphony-binding==0.0.11->python-symphony) | |
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=2.2.1->pyopenssl->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/7e/4a/b647e46faaa2dcfb16069b6aad2d8509982fd63710a325b8ad7db80f18be/cffi-1.11.5-cp27-cp27m-macosx_10_6_intel.whl | |
Collecting asn1crypto>=0.21.0 (from cryptography>=2.2.1->pyopenssl->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl | |
Collecting enum34; python_version < "3" (from cryptography>=2.2.1->pyopenssl->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl | |
Collecting ipaddress; python_version < "3" (from cryptography>=2.2.1->pyopenssl->python-symphony) | |
Using cached https://files.pythonhosted.org/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl | |
Collecting jsonref (from bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/3a/fe/42aca2f2a2e668375a92fcf74e0977a4943ca508e171c9a311b7d5fb9b07/jsonref-0.1.tar.gz | |
Collecting jsonschema[format]>=2.5.1 (from bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl | |
Collecting simplejson (from bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/8b/6c/c512c32124d1d2d67a32ff867bb3cdd5bfa6432660975f7ee753ed7ad886/simplejson-3.15.0.tar.gz (80kB) | |
100% |████████████████████████████████| 81kB 3.3MB/s | |
Collecting swagger-spec-validator>=2.0.1 (from bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/44/02/bcc0122d561d9727b8ca476058f2c57a37a1c86d0f7c9aec5543f3219cd0/swagger_spec_validator-2.1.0-py2.py3-none-any.whl | |
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=2.2.1->pyopenssl->python-symphony) | |
Collecting functools32; python_version == "2.7" (from jsonschema[format]>=2.5.1->bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz | |
Collecting strict-rfc3339; extra == "format" (from jsonschema[format]>=2.5.1->bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/56/e4/879ef1dbd6ddea1c77c0078cd59b503368b0456bcca7d063a870ca2119d3/strict-rfc3339-0.7.tar.gz | |
Collecting webcolors; extra == "format" (from jsonschema[format]>=2.5.1->bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/1d/44/c4902683be73beba20afd299705e11f0a753a01cc7f9d6a070841848605b/webcolors-1.8.1-py2.py3-none-any.whl | |
Collecting rfc3987; extra == "format" (from jsonschema[format]>=2.5.1->bravado-core>=4.11.0->bravado->python-symphony-binding==0.0.11->python-symphony) | |
Downloading https://files.pythonhosted.org/packages/4b/1d/315c7ce4b928af5f334bea695b274517249e56111e25032093cbdc219a55/rfc3987-1.3.7-py2.py3-none-any.whl | |
Building wheels for collected packages: python-symphony, python-symphony-binding, bs4, jsonref, simplejson, functools32, strict-rfc3339 | |
Running setup.py bdist_wheel for python-symphony ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/00/a6/50/75c4e74411ad00d478f0d2566b0381b9450b49dfdc0a958995 | |
Running setup.py bdist_wheel for python-symphony-binding ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/60/2d/72/b7ccc41ae7c02209ac114898368b17947c5a6843f849348f7f | |
Running setup.py bdist_wheel for bs4 ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/a0/b0/b2/4f80b9456b87abedbc0bf2d52235414c3467d8889be38dd472 | |
Running setup.py bdist_wheel for jsonref ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/9b/ac/52/1caebe0f45f2a559ed3d79760dd3c913972abc73d665208593 | |
Running setup.py bdist_wheel for simplejson ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/2c/96/fb/b63af7400da79753dcd2a3f9bf5e7a3010e8d0233844445c2c | |
Running setup.py bdist_wheel for functools32 ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/b5/18/32/77a1030457155606ba5e3ec3a8a57132b1a04b1c4f765177b2 | |
Running setup.py bdist_wheel for strict-rfc3339 ... done | |
Stored in directory: /Users/matt.joyce/Library/Caches/pip/wheels/bb/af/c9/b6e9fb5f9b2470e4ed2a7241c9ab3a8cdd3bc8555ae02ca2e6 | |
Successfully built python-symphony python-symphony-binding bs4 jsonref simplejson functools32 strict-rfc3339 | |
Installing collected packages: idna, urllib3, certifi, chardet, requests, six, pycparser, cffi, asn1crypto, enum34, ipaddress, cryptography, pyopenssl, httpretty, pytz, jsonref, functools32, strict-rfc3339, webcolors, rfc3987, jsonschema, python-dateutil, simplejson, swagger-spec-validator, pyyaml, msgpack-python, bravado-core, bravado, python-symphony-binding, lxml, configparser, beautifulsoup4, bs4, python-symphony | |
Successfully installed asn1crypto-0.24.0 beautifulsoup4-4.6.0 bravado-9.2.2 bravado-core-5.0.1 bs4-0.0.1 certifi-2018.4.16 cffi-1.11.5 chardet-3.0.4 configparser-3.5.0 cryptography-2.2.2 enum34-1.1.6 functools32-3.2.3.post2 httpretty-0.9.4 idna-2.6 ipaddress-1.0.22 jsonref-0.1 jsonschema-2.6.0 lxml-4.2.1 msgpack-python-0.5.6 pycparser-2.18 pyopenssl-18.0.0 python-dateutil-2.7.3 python-symphony-0.2.6 python-symphony-binding-0.0.11 pytz-2018.4 pyyaml-3.12 requests-2.18.4 rfc3987-1.3.7 simplejson-3.15.0 six-1.11.0 strict-rfc3339-0.7 swagger-spec-validator-2.1.0 urllib3-1.22 webcolors-1.8.1 | |
That gets us all installed and setup. | |
(EXAMPLE-OSS) matt.joyce@prometheus ~/SYMPHONY/OSS/test python hello_world.py | |
connected: REDACTED | |
/Users/matt.joyce/SYMPHONY/OSS/test/EXAMPLE-OSS/lib/python2.7/site-packages/bravado/warning.py:23: Warning: [DEPRECATED] post_v3_stream_sid_message_create has now been deprecated. | |
warnings.warn(message, Warning) | |
/Users/matt.joyce/SYMPHONY/OSS/test/EXAMPLE-OSS/lib/python2.7/site-packages/bravado_core/spec.py:289: Warning: MessageML format is not registered with bravado-core! | |
category=Warning, | |
(<bravado.requests_client.RequestsResponseAdapter object at 0x108bb5b90>, V2Message(attachments=[], fromUserId=REDACTED, id=u'REDACTED', message=u'<messageML> test </messageML>', streamId=u'REDACTED', timestamp=u'1527786732724', v2messageType=u'V2Message')) | |
So that's a successful test message sent! | |
hello_world.py: | |
(EXAMPLE-OSS) matt.joyce@prometheus ~/SYMPHONY/OSS/test cat hello_world.py | |
#!/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('example.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 "%s: %s" % (status_code, retstring) | |
print ret | |
except Exception as err: | |
print err | |
print agent | |
# print(retstring) | |
if __name__ == "__main__": | |
main() | |
bot config file: | |
(EXAMPLE-OSS) matt.joyce@prometheus ~/SYMPHONY/OSS/test cat example.cfg | |
[symphony] | |
symphony_pod_uri: https://corporate.symphony.com/pod/ | |
symphony_keymanager_uri: https://corporate-api.symphony.com:8444/ | |
symphony_agent_uri: https://corporate.symphony.com/agent/ | |
symphony_sessionauth_uri: https://corporate-api.symphony.com:8444/ | |
symphony_p12: bot.example.p12 | |
symphony_pwd: REDACTED | |
symphony_sid: REDACTED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment