Skip to main content

DDnet econ

Project description

Installation

pip install ddecon

Usage/Examples

sync

import os

from ddecon import ECON

if __name__ == "__main__":
    econ = ECON(
        os.getenv("econ_ip"), int(os.getenv("econ_port")), os.getenv("econ_password")
    )
    econ.connect()
    econ.message("Hello World")
    while True:
        message = econ.read()
        if message is None:
            continue
        print(message.decode()[:-3])

async

import asyncio
import os

from ddecon import AsyncECON


async def send_hello(econ):
    count = 0
    while True:
        count += 1
        await econ.message(f"Hello, world!, {count}")
        await asyncio.sleep(5)


async def main():
    econ = AsyncECON(
        os.getenv("econ_ip"), int(os.getenv("econ_port")), os.getenv("econ_password")
    )
    await econ.connect()
    asyncio.create_task(send_hello(econ))
    while True:
        message = await econ.read()
        if message is None:
            continue
        print(message.decode()[:-3])


asyncio.run(main())

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

ddecon-0.2.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

ddecon-0.2.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file ddecon-0.2.2.tar.gz.

File metadata

  • Download URL: ddecon-0.2.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ddecon-0.2.2.tar.gz
Algorithm Hash digest
SHA256 490858f9061b966bccd271e92fbd6887c71c55e58d741daa7d86a1d28afbad64
MD5 0e94752dbbee42344fcb40f85e61ea05
BLAKE2b-256 d172790bd14a79e98fd2a662597a789730fd3151361c8ef9eca1bc16032aaf4c

See more details on using hashes here.

File details

Details for the file ddecon-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ddecon-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ddecon-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f65fddf651638c71ec2a79334ee134f88041e68f045299321c796ac0b6091e84
MD5 21f6511a5b75e5df1d7fe66f505300e0
BLAKE2b-256 7d68f68fe7f879ab8690260335e39c7a91cf52de62b6410f24c9ef22da57aa15

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