mosquito / aiohttp-xmlrpc

XMLRPC for aiohttp
MIT License
34 stars 19 forks source link

Fix recursive struct parsing #1

Closed infotim closed 8 years ago

infotim commented 8 years ago

server.py

from aiohttp import web
from aiohttp_xmlrpc import handler

class XMLRPCExample(handler.XMLRPCView):
    def rpc_test(self):
        return {
            'nested': {
                'struct': 'broken',
            }
        }

app = web.Application()
app.router.add_route('*', '/', XMLRPCExample)

if __name__ == "__main__":
    web.run_app(app)

client.py

import asyncio
import pprint

from aiohttp_xmlrpc.client import ServerProxy

loop = asyncio.get_event_loop()
client = ServerProxy("http://127.0.0.1:8080/", loop=loop)

async def main():
    pprint.pprint(await client.test())
    client.close()

if __name__ == "__main__":
    loop.run_until_complete(main())

Output from client: {'nested': {'struct': 'broken'}, 'struct': 'broken'}

mosquito commented 8 years ago

Thank you

mosquito commented 8 years ago

I already uploaded a new version into pypi.