Skip to main content

openttd-protocol

GitHub License GitHub Tag GitHub commits since latest release

GitHub Workflow Status (Testing) GitHub Workflow Status (Release)

This library implements the OpenTTD network protocol. It mostly is meant to be used for OpenTTD's backend services, like BaNaNaS server and master server.

Usage

pip install openttd-protocol

Now in your Python code you can import the protocol. Example:

import asyncio
import logging

from openttd_protocol.protocol.coordinator import CoordinatorProtocol

log = logging.getLogger(__name__)


class Application:
    async def receive_PACKET_COORDINATOR_CLIENT_REGISTER(self, source, protocol_version, game_type, server_port):
        # Your logic goes here
        pass


def main():
    application = Application()

    loop = asyncio.get_event_loop()
    server = loop.run_until_complete(loop.create_server(lambda: CoordinatorProtocol(application), host="127.0.0.1", port=12345, reuse_port=True, start_serving=True))

    try:
        loop.run_until_complete(server.serve_forever())
    except KeyboardInterrupt:
        pass

    log.info("Shutting down game_coordinator ...")
    server.close()

if __name__ == "__main__":
    main()

Release files for openttd-protocol 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openttd-protocol 1.7.1
File Size Uploaded
openttd-protocol-1.7.1.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openttd-protocol 1.7.1
File Interpreter ABI Platform
openttd_protocol-1.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 53.8 kB

Release files / openttd-protocol-1.7.1.tar.gz

Download URL openttd-protocol-1.7.1.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
be1a6f046bc3e493527ffe6594088114d8dcd424116a9738d815229e411f684d
BLAKE2b-256 checksum
How to use checksums
a266444e1c48f023301d20c78cdea69522800ed1545419fd0ca86e316a9a3601
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / openttd_protocol-1.7.1-py3-none-any.whl

Download URL openttd_protocol-1.7.1-py3-none-any.whl
Size 29.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23cd696edc8952303d20f2a81c2680ae17f442499fb946882b004eefdcbafd9b
BLAKE2b-256 checksum
How to use checksums
8f24f00cebfd2eac7ed7fe99d91f9530b063825f4586232db6663d3e4159471a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release history Release notifications | RSS feed

This release

1.7.1 This release

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page