Skip to main content

npynx

twisted based http server with multiple domain support

usage

from test/TestServer.py

from jinja2 import Template
from npynx import Server, Domain, response


class DomainTest(Domain):
    root_template = Template("ON {{ ROOT }}")

    def root(self, *args):
        return response(body=self.root_template.render(content="/"))

    def another(self, *args):
        return response(body=self.root_template.render(content="/another"))

    def __init__(self):
        Domain.__init__(self, "127.0.0.1:4200", {
            "": self.root,
            "/": self.root,
            "/another": self.another,
        })


if __name__ == '__main__':
    server = Server("tcp:4200")
    domain_test = DomainTest()
    server.add_domain(domain_test)

    try:
        server.start()
        server.join()
    except KeyboardInterrupt:
        server.terminate()

Metadata

Release files for npynx 1.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 npynx 1.0
File Size Uploaded
npynx-1.0.tar.gz 2.9 kB Details

Release files / npynx-1.0.tar.gz

Download URL npynx-1.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96e12b44940b140655b1aeac094273cfca9c2342114cf1141c6df5c1d71a0157
BLAKE2b-256 checksum
How to use checksums
79677cbd4a1453e85328d5551f522a363e94693062799f8369b96e07ee2af7c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

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