{"id":19204547,"url":"https://github.com/openttd/py-protocol","last_synced_at":"2025-05-12T15:46:31.420Z","repository":{"id":46403565,"uuid":"370652626","full_name":"OpenTTD/py-protocol","owner":"OpenTTD","description":"OpenTTD's wire protocol as Python library","archived":false,"fork":false,"pushed_at":"2024-01-27T10:14:20.000Z","size":68,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-20T14:42:55.765Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenTTD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-05-25T10:25:49.000Z","updated_at":"2024-04-27T19:41:26.000Z","dependencies_parsed_at":"2024-01-26T22:26:42.528Z","dependency_job_id":"c13e9263-91b3-4b99-bfd6-c8ee8f94b89b","html_url":"https://github.com/OpenTTD/py-protocol","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"2842d7c6a67768e82e7ebe192e643ad43a00dfc6"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fpy-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fpy-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fpy-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fpy-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenTTD","download_url":"https://codeload.github.com/OpenTTD/py-protocol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253767744,"owners_count":21961172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T13:08:41.609Z","updated_at":"2025-05-12T15:46:31.384Z","avatar_url":"https://github.com/OpenTTD.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openttd-protocol\n\n[![GitHub License](https://img.shields.io/github/license/OpenTTD/py-protocol)](https://github.com/OpenTTD/py-protocol/blob/main/LICENSE)\n[![GitHub Tag](https://img.shields.io/github/v/tag/OpenTTD/py-protocol?include_prereleases\u0026label=stable)](https://github.com/OpenTTD/py-protocol/releases)\n[![GitHub commits since latest release](https://img.shields.io/github/commits-since/OpenTTD/py-protocol/latest/main)](https://github.com/OpenTTD/py-protocol/commits/main)\n\n[![GitHub Workflow Status (Testing)](https://img.shields.io/github/workflow/status/OpenTTD/py-protocol/Testing/main?label=main)](https://github.com/OpenTTD/py-protocol/actions?query=workflow%3ATesting)\n[![GitHub Workflow Status (Release)](https://img.shields.io/github/workflow/status/OpenTTD/py-protocol/Release?label=release)](https://github.com/OpenTTD/py-protocol/actions?query=workflow%3A%22Release%22)\n\nThis library implements the OpenTTD network protocol.\nIt mostly is meant to be used for OpenTTD's backend services, like [BaNaNaS server](https://github.com/OpenTTD/bananas-server) and [master server](https://github.com/OpenTTD/master-server).\n\n# Usage\n\n`pip install openttd-protocol`\n\nNow in your Python code you can import the protocol.\nExample:\n\n```python\nimport asyncio\nimport logging\n\nfrom openttd_protocol.protocol.coordinator import CoordinatorProtocol\n\nlog = logging.getLogger(__name__)\n\n\nclass Application:\n    async def receive_PACKET_COORDINATOR_CLIENT_REGISTER(self, source, protocol_version, game_type, server_port):\n        # Your logic goes here\n        pass\n\n\ndef main():\n    application = Application()\n\n    loop = asyncio.get_event_loop()\n    server = loop.run_until_complete(loop.create_server(lambda: CoordinatorProtocol(application), host=\"127.0.0.1\", port=12345, reuse_port=True, start_serving=True))\n\n    try:\n        loop.run_until_complete(server.serve_forever())\n    except KeyboardInterrupt:\n        pass\n\n    log.info(\"Shutting down game_coordinator ...\")\n    server.close()\n\nif __name__ == \"__main__\":\n    main()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenttd%2Fpy-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenttd%2Fpy-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenttd%2Fpy-protocol/lists"}