Skip to main content

This package allows you to connect to TPC servers as a client and send packets.

Project description

The Puzzle Cell Client Python Package

This package allows you to connect to TPC servers as a client and send packets.

Available at PyPi

Documentation

Install

To use The Puzzle Cell Client, install it using pip:

pip install thepuzzlecell

Quickstart

Here is a quick example:

import thepuzzlecell

async def test():
    connection = await thepuzzlecell.client("wss://tpc.milenakos.repl.co", "2.0", "Hello World Client")
    
    await connection.send_packet("Hello")
    await connection.send_packet("World!")

    for y in range(0, 10):
        await connection.place(x=0, y=y, id="push")

    print(connection.get_packets())
    
    await connection.close()

asyncio.run(test())

Easy, right?

API and stuff

  • thepuzzlecell

    • client(ip, version="2.0", client_id="PythonUser", auto_reconnect=False) creates a Client() and returns it

    • Client is main class

      • async connect() does not take any arguments and runs on self variables

      • listen() runs a loop to listen for any incoming packets (interal; not recommended to use externally)

      • async get(websocket) returns information from given websocket

      • async send_packet(data) send given information into self.websocket

      • async close() closes self.websocket

      • get_packets(**wait_until_packet=False) gets packets collected by listen()

        • get_packet(**wait_until_packet=False) is an alias for it
      • async place(**x, **y, **id, **rot=0, **heat=0) places cell

      • async bg(**x, **y, **bg="placeable") sets background (placeables)

      • async setinit(code) sets initial state on the server

      • async new_hover(**uuid=self.client_id, **x, **y, **id, **rot=0) creates new hover

      • async set_hover(**uuid=self.client_id, **x, **y) sets the new hover position

      • async drop_hover(uuid=self.client_id) removes the hover

      • async set_cursor(**uuid=self.client_id, **x, **y) sets cursor state

Project details


Download files

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

Source Distribution

thepuzzlecell-0.0.4.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

thepuzzlecell-0.0.4-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

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