Skip to main content

A python wrapper for the Rust Plus API

Project description

Rust+.py

A lot of code and ideas have come from the JavaScript version of a wrapper, so I will credit it now: RustPlus.js I have used their Protocol Buffer file for this, as well as instructions on how to use the command line tool to get the information you need.

Installation:

Install the package with:

pip install rustplus

It should also install all the dependencies, but if not you will have to install them yourself

Usage:

from  rustplus  import  RustSocket

rust_socket = RustSocket("IPADDRESS", "PORT", 64BITSTEAMID, PLAYERTOKEN)
#See below for more information on the above ^^

#Connects to the server's websocket
rust_socket.connect()

"""
For information on the following see below
"""
#Get mapMarkers:
markers = rust_socket.getMarkers()

#Get Server Info:
info = rust_socket.getInfo()

#Get Current time:
time = rust_socket.getTime()

#Getting Team info
team_info = rust_socket.getTeamInfo()

#Getting Team Chat:
team_chat = rust_socket.getTeamChat()

#Sending a Team Chat message:
status = rust_socket.sendTeamMessage("Yo! I sent this with Rust+.py")

#Get Camera Image:
camera_image = rust_socket.getCameraFrame("CAMID",FRAMENO)

#Get Map Image:
rust_map = rust_socket.getMap(addIcons = True, addEvents = True, addVendingMachines= True, overrideImages = {})

#Getting Map Data
rust_map_data = rust_socket.getRawMapData()

#Get Entity Information
entity_info = rust_socket.getEntityInfo(ENTITYID)

#Turning On/Off a Smart Switch
rust_socket.turnOffSmartSwitch(ENTITYID)
rust_socket.turnOnSmartSwitch(ENTITYID)

#Promoting a TeamMate to team leader
rust_socket.promoteToTeamLeader(SteamID)

#Getting the contents of a TC:
tc_contents = rust_socket.getTCStorageContents(ENTITYID, MERGESTACKS : bool)

#Getting Current Map Events
events = rust_socket.getCurrentEvents()

rust_socket.closeConnection()

For information on all of the above methods, see the Wiki

Support:

If you need help, or you think that there is an issue feel free to open an issue. If you think you have made some improvements, open a PR!

I have tried to explain this a well as possible, but if you should need further clarification, join me on my discord server: here

GitHub ⭐'s are always welcome :)

Have Fun!

Project details


Release history Release notifications | RSS feed

This version

3.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustplus-3.0.tar.gz (682.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rustplus-3.0-py3-none-any.whl (687.7 kB view details)

Uploaded Python 3

File details

Details for the file rustplus-3.0.tar.gz.

File metadata

  • Download URL: rustplus-3.0.tar.gz
  • Upload date:
  • Size: 682.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for rustplus-3.0.tar.gz
Algorithm Hash digest
SHA256 e494c62af81995d56c23b4c5c9d51e7eed8fb63c4a331dfa97d96647edb5b71e
MD5 3a953f66f917ab979631b100ef512534
BLAKE2b-256 9d45a69f7adabd8c1356ed5142d8936ad33d7eeffe5cd207f563e9638a2bfc34

See more details on using hashes here.

File details

Details for the file rustplus-3.0-py3-none-any.whl.

File metadata

  • Download URL: rustplus-3.0-py3-none-any.whl
  • Upload date:
  • Size: 687.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for rustplus-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e70cc0937732ab7572efb13606493798f29d8cbfea58a36e131ad8f9af8e6fb
MD5 db50e3b02d2364cb5242f7fb94ae89ef
BLAKE2b-256 ef7ede5890baebf89ade08aa6a13ee6d5a5c9294f8ed9c6c5cb83ede92cf7c1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page