Skip to main content

A Python library for utilizing the Nebulous.io UDP protocol.

Project description

nebulous.py

PyPI - Version PyPI - Python Version


Table of Contents

Installation

  1. Install git
  2. Install java-random: python -m pip install --user git+https://github.com/MostAwesomeDude/java-random
    • NOTE: This is a required step, as the java-random package on pypi is outdated and broken.
  3. Install nebulous.py: python -m pip install --user nebulous.py

Usage

From test_connect.py:

import time

from nebulous.game.account import ServerRegions
from nebulous.game.models.client import Client, ClientCallbacks
from nebulous.game.packets import ConnectRequest3, ConnectResult2, Disconnect, KeepAlive


TEST_TICKET = ""


class TestCallbacks(ClientCallbacks):
    def on_connect(self, client: Client, packet: ConnectRequest3) -> ConnectRequest3:
        print("Connected to server")
        return packet

    def on_disconnect(self, client: Client, packet: Disconnect) -> Disconnect:
        print("Disconnected from server")
        return packet

    def on_keep_alive(self, client: Client, packet: KeepAlive) -> KeepAlive:
        print("Sending keep alive packet")
        return packet

    def on_connect_result(self, client: Client, packet: ConnectResult2) -> ConnectResult2:
        print(f"Received connection result: {packet.result}")
        return packet


def test_client():
    client = Client(TEST_TICKET, ServerRegions.US_EAST, callbacks=TestCallbacks())

    client.start()

    # disconnect after 3 seconds.
    # can also use client.run_forever() to keep the client running indefinitely
    # until ctrl+c is pressed.
    time.sleep(3)

    client.stop()


if __name__ == "__main__":
    test_client()

You can also dump packets as json, as shown in sample_packet.json:

print(packet.as_json(indent=4))

License

nebulous.py is distributed under the terms of the MIT license.

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

nebulous_py-1.2.1.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

nebulous_py-1.2.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file nebulous_py-1.2.1.tar.gz.

File metadata

  • Download URL: nebulous_py-1.2.1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.25.2

File hashes

Hashes for nebulous_py-1.2.1.tar.gz
Algorithm Hash digest
SHA256 f0467a501795aae2084de590654f3a31ee158106120dd01540a02d84f8156b86
MD5 4613b189f4521ca4c6083ea1f90f4f5e
BLAKE2b-256 67ebf518d11f770cfb4a9b15af3982b6c9f18baa483b7cf9bf6b7abd86c85628

See more details on using hashes here.

File details

Details for the file nebulous_py-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nebulous_py-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1013810ae3df8c075a3da5f4709b96754f057b9c9993c78b28d436ddb15c757d
MD5 e4b7aef5e46f0fe2856f1e11bd9dcee8
BLAKE2b-256 488c4dd6d6cc580ec13c6b4de396020f7b00277541b6107df1ca6fb8e3b919d1

See more details on using hashes here.

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