{ "info": { "author": "Andr\u00e9 Matos de Sousa", "author_email": "andrematosdesousa@gmail.com", "bugtrack_url": null, "classifiers": [ "Operating System :: Microsoft :: Windows", "Programming Language :: Python :: 3.7" ], "description": "## lcu-driver\n\nPython interface for LCU API. Only support Windows platform. Inspired in [lcu-connector](https://github.com/Pupix/lcu-connector)\n\n## Download\n - `pip install lcu-driver`\n\n## Code example\n##### Change to a random chinese icon every time your run the application.\n```python\nfrom json import dumps\nfrom random import randint\n\nfrom lcu_driver import Connector\n\n\nconnector = Connector()\n\n\nasync def set_random_icon():\n # random number of a chinese icon\n random_number = randint(50, 78)\n\n # make the request to set the icon\n icon = await connector.request('put', '/lol-summoner/v1/current-summoner/icon',\n data=dumps({'profileIconId': random_number}))\n\n # if HTTP status code is 201 the icon was applied successfully\n if icon.status == 201:\n print(f'Chinese icon number {random_number} was set correctly.')\n else:\n print('Unknown problem, the icon was not set.')\n\n# fired when LCU API is ready to be used\n@connector.event\nasync def connect():\n print('LCU API is ready to be used.')\n\n # check if the user is already logged into his account\n summoner = await connector.request('get', '/lol-summoner/v1/current-summoner')\n if summoner.status == 200:\n data = await summoner.json()\n\n # calls login method and update login.left_calls to 0\n # when login.left_calls is 0 the function can't be fired any more neither by websocket nor manually\n await login(None, None, data)\n\n else:\n print('Please login into your account to change your icon...')\n\n\n# fired when League Client is closed (or disconnected from websocket)\n@connector.event\nasync def disconnect():\n print('The client have been closed!')\n\n# subscribe to the login websocket event, and calls the function only one time\n@connector.ws_events(['/lol-summoner/v1/current-summoner'], event_types=['Update'],\n max_calls=1)\nasync def login(typ, uri, data):\n print('Logged as', data['displayName'])\n await set_random_icon()\n\n\n# opens websocket connection (may be used to wait until the client is closed)\nconnector.listen()\n# starts everything\nconnector.start()\n```\n\n## Classes and methods\n### ***class* Connector**\n - #### \\_\\_init\\_\\_(self, *, loop=None)\n - **loop**\n\n### Properties\n - #### pid\n Process Id.\n - #### protocols\n Tuple of allowed protocols.\n - #### port\n - #### auth_key\n - #### installation_path\n - #### address\n - #### ws_address\n \n### Methods\n - #### start()\n Start the driver.\n\n - #### listen()\n Keep connected until client closes. (open websocket connection).\n \n - #### ** stop_ws()\n Gracefully stops the websocket loop.\n \n - #### *coroutine* request(method: str, endpoint: str, **kwargs)\n - **method** - HTTP verb.\n - **endpoint** - Resource URL without protocol and host name.\n - **\\*\\*kwargs**\n - [**.request**](https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L279) - function arguments\n - **path** - Alias to *str.format()*\n \n - #### ws_events(endpoints: list, *, event_types: list, max_calls=-1)\n - **endpoints** - List of URIs.\n - **event_types** - List of events types (Create, Update or Delete).\n - **max_calls** - Maximum times an event function can be called either by the websocket or manually. Set it to negative numbers to remove the limit.\n\n### Built-in library events\n - #### connect\n Fired when LCU API starts.\n - #### disconnect\n Fired when the client is closed.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sousa-andre/lcu-driver/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lcu-driver", "package_url": "https://pypi.org/project/lcu-driver/", "platform": "", "project_url": "https://pypi.org/project/lcu-driver/", "project_urls": { "Homepage": "https://github.com/sousa-andre/lcu-driver/", "Source": "https://github.com/sousa-andre/lcu-driver/" }, "release_url": "https://pypi.org/project/lcu-driver/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "", "version": "1.0.0" }, "last_serial": 5693844, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6fa8343862d3b16591f88b4178ba3f39", "sha256": "8329c8cb5b0b07ccbb0a812dc5de1c85bacf8060e19fb3e2cc8b0622f98735e2" }, "downloads": -1, "filename": "lcu_driver-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6fa8343862d3b16591f88b4178ba3f39", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5703, "upload_time": "2019-06-18T20:09:01", "url": "https://files.pythonhosted.org/packages/aa/81/3700c3a9ea73ce209db57704cebda8e8bbc9aa68103f2e87a588d7eae285/lcu_driver-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a7f8f48d28a1b4753379762ccec0b814", "sha256": "ed9eda46cf5772cb824102d5895f648a9d6a627638ad83e478424cbdf050b94e" }, "downloads": -1, "filename": "lcu-driver-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a7f8f48d28a1b4753379762ccec0b814", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4446, "upload_time": "2019-06-18T20:09:03", "url": "https://files.pythonhosted.org/packages/02/a1/532e21ae1801008e7b2130744f0b4a7195ae97814ce08a054d93bc29366a/lcu-driver-0.0.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "57efe93ce4aaac4f6f5efd2a7d29f66d", "sha256": "1b65b178348a00224c22e59cfb02b3247930b9400bbabad168f37d83c78cb838" }, "downloads": -1, "filename": "lcu-driver-1.0.0.tar.gz", "has_sig": false, "md5_digest": "57efe93ce4aaac4f6f5efd2a7d29f66d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5236, "upload_time": "2019-08-18T08:10:25", "url": "https://files.pythonhosted.org/packages/91/95/7cf5ea78a83c96a283cc758d7350650cb9c754a7cd792a70fb0805e06f33/lcu-driver-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "57efe93ce4aaac4f6f5efd2a7d29f66d", "sha256": "1b65b178348a00224c22e59cfb02b3247930b9400bbabad168f37d83c78cb838" }, "downloads": -1, "filename": "lcu-driver-1.0.0.tar.gz", "has_sig": false, "md5_digest": "57efe93ce4aaac4f6f5efd2a7d29f66d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5236, "upload_time": "2019-08-18T08:10:25", "url": "https://files.pythonhosted.org/packages/91/95/7cf5ea78a83c96a283cc758d7350650cb9c754a7cd792a70fb0805e06f33/lcu-driver-1.0.0.tar.gz" } ] }