LAN-PLAY API Python
Project description
LanPlay API
This is the unofficial API for LanPlay.
It's made for getting servers, rooms, games and players easily from LanPlay API.
It was designed to make life easier for developers with LanPlay. It’s a more direct and simple interface with the API.
Table of Contents
Installation
pip install lanplaypy
Script Example
- Here is an example of a simple script using LanPlay API
import asyncio
import lanplay
# The LAN_PLAY_API_KEY can be found in the Console Mode of any Web Browser by following these steps:
# - Open a Web Browser and go to http://www.lan-play.com
# - Open a Console Mode ('Ctrl + Shift + C' should work, or else Google is your friend :))
# - Go to 'Network' tab and refresh the current page
# - Search a line named 'getMonitors' and click on it
# - Open the 'Payload' tab
# - Copy the 'api_key' value and paste it into the LanPlay('LAN_PLAY_API_KEY') definition below
async def main():
# Create an instance of the LanPlay class with LAN_PLAY_API_KEY
# It's the main variable where all data will be stored
lan = lanplay.LanPlay('LAN_PLAY_API_KEY')
# Initialize the server
await lan.setServer('joinsg.net:11453') # Or 'http:/joinsg.net:11453/' will works too
# You can now access all data from 'lan' variable
# Here are some useful examples below
for room in lan.rooms:
# Display games info of a room
print(room.host_player_nintendo_name) # Unique Nintendo host player name
print(room.game.name) # Or 'room.game' will also displays the name of the game
print(room.game.icon_url) # Useful when you want a cool picture of the current game played
print(room.game.size) # To see if you've enough space to download this game on your Switch...
for player in room.players:
# Display players infos of a room
print(player.player_name) # Or 'player' will also displays the name of the player
print(lan.server_info.online) # Displays the current number of Online players in the server
print(lan.server_info.idle) # Displays the current number of Idle players in the server
print(lan.servers) # Useful when you don't know wich LanPlay server to choose...
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
- Or you can also use it in CLI as well with the same syntax.
Contributing
Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/NewFeature) - Commit your Changes (
git commit -m 'Add some NewFeature') - Push to the Branch (
git push origin feature/NewFeature) - Open a Pull Request
Thanks to every contributors who have contributed in this project.
License
Distributed under the MIT License. See LICENSE for more information.
Author/Maintainer: Garoh | Discord: GarohRL#4449
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lanplaypy-1.0.0.tar.gz.
File metadata
- Download URL: lanplaypy-1.0.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddec22e499878dabf272573fd4b2c0456e06b321a9195d465a9946821c2d247a
|
|
| MD5 |
e1a1f2459aca5e74c67fa70886db203a
|
|
| BLAKE2b-256 |
d246bdb34b7016da73e403058645f887f337b18114deb9b41ef3fad3df4276d3
|
File details
Details for the file lanplaypy-1.0.0-py3-none-any.whl.
File metadata
- Download URL: lanplaypy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be00eed91e53fa00198b5ba2f07148e734b859c6e59328ead41c815fb0629cfe
|
|
| MD5 |
b2929d68377d9167c165af3d54b14eb7
|
|
| BLAKE2b-256 |
1158325f8c2aba463de5221bef13d9572eb2b9e1379b4195a5eebec06573ace0
|