{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import xmlrpclib\n", "import ssl" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "context = ssl._create_default_https_context()\n", "context.check_hostname = False\n", "context.verify_mode = ssl.CERT_NONE" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "url = \"https://localhost:5000\"\n", "#url = \"https://localhost:8443\"" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "twitcher = xmlrpclib.ServerProxy(url, context=context)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.clear_services()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.list_services()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{'access_token': '695b289f150548cd815fdf377b04ed07', 'expires_at': 1484156404}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.generate_token(1, {})" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{'c4i': False,\n", " 'name': 'emu',\n", " 'public': False,\n", " 'type': 'WPS',\n", " 'url': 'http://localhost:8094/wps'}" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.register_service(\"http://localhost:8094/wps\", \n", " {'name': \"emu\", 'type': \"WPS\", 'public': False}, \n", " False)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[{'c4i': False,\n", " 'name': 'emu',\n", " 'public': False,\n", " 'type': 'WPS',\n", " 'url': 'http://localhost:8094/wps'}]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.list_services()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.unregister_service('emu')" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twitcher.list_services()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }