Package: willump
New in Willump 1.4.0Nunu got a few new tricks, and now auto generates ssl certificates and keys. Anyone can create nunu apps now without too much network administration pre-requisite information!New in Willump 1.3.0Willump now handles authentication tokens with '=' inside them! Woo!New in Willump 1.2.6Nunu: The server that translates Yeti to EnglishRead theNunureadme and get started with your League of Legends webapp today!WillumpWillump is a Python3 helper for the League of Legends LCU API. Willump is asynchronous and can communicate on both HTTPS and WSS channels.Willump would not exist withoutlcu-driver, another driver for the League of Legends LCU API. Huge thanks toAndre Sousafor creating the starting point for Willump.Documentation for the LCU can be found on theHextech Docs, and a schema of the LCU can be foundhere.If you have questions about Willump or the Riot API, find me or ask a question at theRiot Games Third Party Developer CommunityDiscord.Installing WillumpWillump can be installed through pippip install willumpOrpip3if using python3 pipStarting WillumpThere are two ways to start WillumpfromwillumpimportWillump#if you want to import the classwllp=awaitWillump.start()Orimportwillumpwllp=awaitwillump.start()this is generally fine since Willump contains no class methodsThis starts Willump's http and websocket clients. Note:start()blocks until Willump can connect to the League Client Ux process and serverUsing HTTP methodsWillump can can make http requests to any LCU endpointresponse=awaitwllp.request('get','/lol-summoner/v1/current-summoner')#request can be used to execute 'get', as well as any other http methodprint(awaitresponse.json())Subscribing to websocket eventsWillump's websocket can subscribe to LCU events. Willump can attach a user defineddefault_handlerto an event subscription which will be fired any time Willump receives a websocket message pertaining to the event and the message is not otherwise handled.default_handleris a function which accepts json formatted data as its sole argument and returns None, or a disposable value.asyncdefun_default_handler(data):print("user defined default event handler")print(json.dumps(data,indent=4,sort_keys=True))my_first_subscription=awaitwllp.subscribe('OnJsonApiEvent',default_handler=un_default_handler)You can add subscriptions to an event by resubscribing to the same eventnew_subscription=awaitwllp.subscribe('OnJsonApiEvent')If you want to attach an already made subscription to another event, you can pass it to the subscription handler:same_as_new_subscription=awaitwllp.subscribe('OnJsonApiEvent_patcher_v1_status',subscription=new_subscription)print(same_subscription_as_new_subscriptionisnew_subscription)#True, subscription is shallow copiedYou can get the attached subscriptions to an event:all_subscriptions=wllp.get_subscriptions('OnJsonApiEvent')Willump can also unsubscribe from events to stop listening for them entirely, or can remove a subscription from an event:awaitwllp.unsubscribe('OnJsonApiEvent',my_first_subscription)#new_subscription is still activeawaitwllp.unsubscribe('OnJsonApiEvent')#This removes new_subscription,#as well as any other subscriptions on 'OnJsonApiEvent'Attaching endpoint filters to event subscriptionsWillump's subscriptions contain two further kinds of filters on websocket events -- uri filters and path filters. These are collectively known as endpoint filters. An endpoint filter is a function that runs when a certain endpoint is specified by the event response. A subscription can have multiple endpoint handlers attached to it. Path filters end in '/', and run when the specified endpoint is any sub-endpoint of the path. Uri filters run when the endpoint is the same as the filter's uri. You can attach endpoint filters through the subscription itself, or via Willump with the subscription instance. Endpoint handlers take the same signature asdefault_handler. They must take in json formatted data and return None, or a disposable value. Uri handlers and path handlers will both fire if they overlap. If an endpoint filter is fired, the subscription'sdefault_handlerwill not fire. Attaching two endpoint handlers to the same endpoint will overwrite the pre-existing endpoint handler.asyncdefcustom_uri_handler(data):print('current-summoner uri got triggered. This is custom_uri_handler')asyncdefcustom_path_handler(data):print('/lol-summoner/ path got triggered. This is custom_path_handler')print('full triggered uri is:',data['uri'])#adding uri endpoint filter via subscription instancemy_first_subscription.filter_endpoint('/lol-summoner/v1/current-summoner',custom_uri_handler)#adding path endpoint filter via subscription instance through Willumpwllp.subscription_filter_endpoint(my_first_subscription,'/lol-summoner/',custom_path_handler)#unfiltering endpointswllp.subscription_unfilter_endpoint(my_first_subscription,'/lol-summoner/')my_first_subscription.unfilter_endpoint('/lol-summoner/v1/current-summoner')Closing WillumpClosing Willump attempts to close the http and ws connections, gather outstanding subscription tasks, and gracefully exit.awaitwllp.close()Willump isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.