async def start(self): self._client = ServerProxy(self.ROOT_URL, loop=self._loop, client=self._session) self._started = True
import asyncio from aiohttp_xmlrpc.client import ServerProxy loop = asyncio.get_event_loop() client = ServerProxy("https://pypi.python.org/pypi", loop=loop) async def main(): pkg = 'aiohttp-xmlrpc' print("Requesting package info", pkg) releases = await client.package_releases(pkg, show_hidden=True) print('Releases', releases) user = '******' print("Find user packages") packages = await client.user_packages(user) print("User", user, "has packages") for role, package in sorted(filter(lambda x: isinstance(x, list), packages)): print("\t%r (role %r)" % (package, role)) client.close() if __name__ == "__main__": loop.run_until_complete(main())
import asyncio from aiohttp_xmlrpc.client import ServerProxy loop = asyncio.get_event_loop() client = ServerProxy("http://127.0.0.1:8080/", loop=loop) async def main(): # 'nested.test' method call print(await client.nested.test()) # 'args' method call print(await client.args(1, 2, 3)) await client.close() if __name__ == "__main__": loop.run_until_complete(main())