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.clear("/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-0.2.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

unpoly-0.2.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unpoly-0.2.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for unpoly-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ae64ab2105d3ffa6699a277980e7812d0066f899a6cc9d0122684990da3b1b8a
MD5 f8181a0b359fd168487a10195770c5b1
BLAKE2b-256 a80719619e141d6c28acad692d9797d7abf53cdf44b7ce6360f0471fb75924a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unpoly-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for unpoly-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f045e94dff8936be9594e026fcb40fed0c3aea66d8515dc4ed6ef32c6c94deb2
MD5 6611d68c55dd4800d90377a99552bef4
BLAKE2b-256 0f5a4fd3086acbc16cb84f8f69b373ecf7c5bb89d61e236dfe154d1c0bc2a0c3

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