Skip to main content

Framework agnostic implementation of the unpoly server-protocol.

Project description

version python versions docs pipeline status coverage report

Unpoly

Unpoly is a framework agnostic python library implementing the Unpoly server protocol.

Features

  • Full protocol implementation: The whole Unpoly server protocol is implemented and well tested.
  • Django support: Out of the box we currently ship a middleware for Django support.
  • Easily extendable: The library abstracts the actual HTTP stuff via adapters and can easily plugged into frameworks like Flask etc.

Download & Install

pip install unpoly

Usage with Django

Add unpoly.contrib.django.UnpolyMiddleware to your middlewares and then you can access request.up. Details can be found in the usage section of the docs.

Example usage:

def my_view(request):
    if request.up: # Unpoly request
        # Send an event down to unpoly
        request.up.emit("test:event", {"event": "params"})
        # ... and also clear the cache for certain paths
        request.up.expire("/users/*")
    else:
        ...

def form_view(request):
    form = MyForm(request.GET)
    # When unpoly wants to validate a form it sends
    # along X-Up-Validate which contains the field
    # being validated.
    if form.is_valid() and not request.up.validate:
        form.save()
    return render(request, "template.html", {"form": form})

Usage with Flask etc

Subclass unpoly.adapter.BaseAdapter and initialize unpoly.Unpoly with it for every request (see the docs for details).

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

unpoly-3.2.0.tar.gz (8.3 MB view details)

Uploaded Source

Built Distribution

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

unpoly-3.2.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file unpoly-3.2.0.tar.gz.

File metadata

  • Download URL: unpoly-3.2.0.tar.gz
  • Upload date:
  • Size: 8.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for unpoly-3.2.0.tar.gz
Algorithm Hash digest
SHA256 353930d904330b194f9f6792f2fb8e52cd2985e2d64d30b7446a5481a5910f22
MD5 6c9d30a5d5b4d1b5f60d599e3ef92731
BLAKE2b-256 7505f95db62e2adbd1a4f329d5da8b2e0131ca001ba9be63700ec2f69a225408

See more details on using hashes here.

File details

Details for the file unpoly-3.2.0-py3-none-any.whl.

File metadata

  • Download URL: unpoly-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for unpoly-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98a5f8b7075aa1fcab49686d8bae970154f072ea56c8b5e46ffdcf03cc7c41ef
MD5 91cf13ce68aa7cbab6b1f06f93a7d30f
BLAKE2b-256 148606eee3284e051b277b56e540cac1356acd07db54a2e83024b645a76e9141

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