Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jjmaldonis/lcu-api
https://github.com/jjmaldonis/lcu-api
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/jjmaldonis/lcu-api
- Owner: jjmaldonis
- Created: 2019-06-13T00:38:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-22T01:57:19.000Z (over 4 years ago)
- Last Synced: 2024-08-01T23:30:41.787Z (5 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 18
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-league - lcu-api - A Python LCU wrapper. (Developer Tools)
README
# lcu-api
This is a (currently un-named) API for working with the League of Legends LCU.
## Usage
There are two ways to use this API.
First, you can make requests directly to the LCU client. You simply input the URI that you want to get data from (or send data to). You can send `GET`, `POST`, and `DELETE` requests manually, by calling, for example `lcu.get(...)`.
Second, you can set the `lcu-api` to passively listen for any events that occur in the client (and there are a lot of them). For example, you can listen for your summoner to enter champion select. This API is more complicated to use because you need to write `EventProcessor` classes that handle events as they are passively sent to this LCU connector. The `usage.py` file has a simple example.
## Example
```python
# Create the LCU object. Make sure the client is open on your computer.
lcu = LCU()# Optionally attach `EventProcessor` classes to handle incoming events. See usage.py
#lcu.attach_event_processor(...)lcu.wait_for_client_to_open()
lcu.wait_for_login()# Open a background thread and listen for & process incoming events
# using the EventProcessors that were attached to the LCU (not shown here, see usage.py).
lcu.process_event_stream()# Here is an example request to get data from the LCU
finished = lcu.get('/lol-platform-config/v1/initial-configuration-complete')
print("Has the client finished it's starting up?", finished)... # Make more requests to the LCU if you want.
# Prevent this program from exiting so that the event stream continues to be read.
# Press Ctrl+C (and wait for another event to get triggered by the LCU) to gracefully terminate the program.
lcu.wait()```