Skip to main content

PyMarko

in development

Example

#!/usr/bin/env python3
from pymarko.udpsocket import Publisher
from pymarko.udpsocket import Subscriber
import time
import sys

HOST, PORT = "10.0.1.116", 9999

def pub():
    pub = Publisher()
    pub.info()
    pub.clientaddr.append((HOST, PORT))
    pub.clientaddr.append((HOST, 9998)) # this one will fail quietly

    for _ in range(20):
        msg = str(time.time()).encode("utf-8")
        pub.publish(msg)

def sub():

    def cb(data):
        print(data)

    try:
        s = Subscriber()
        s.bind(HOST, PORT)
        s.info()
        s.register_cb(cb)
        s.loop()

    except KeyboardInterrupt as e:
        s.event = False
        time.sleep(0.1)
        print(e)
        print("ctrl-z")


if __name__ == "__main__":
    if sys.argv[1] == "p":
        pub()
    elif sys.argv[1] == "s":
        sub()

MIT License

Copyright (c) 2018 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for pymarko 0.5.0

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

Source distribution (sdist)

Source distribution for pymarko 0.5.0
File Size Uploaded
pymarko-0.5.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymarko 0.5.0
File Interpreter ABI Platform
pymarko-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / pymarko-0.5.0.tar.gz

Download URL pymarko-0.5.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5ebd9b0433b3b4e9699829cb2618bddd8bc10e319cb1b82bcb380016b7b10ce8
BLAKE2b-256 checksum
How to use checksums
6328ba0fdeac6d7e3e90143a8435087d1a785852bc6b815fd7b94a41707ab29c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Darwin/21.3.0

Release files / pymarko-0.5.0-py3-none-any.whl

Download URL pymarko-0.5.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ca75d9dbda755a1a7ee9c516869cd7f59423212b27991173680581796d98617
BLAKE2b-256 checksum
How to use checksums
4e9c952268140fc09f600bd8a03fa2cfbb397c0d3b9eddbad5ea030a66685956
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Darwin/21.3.0

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

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