Skip to main content

Django-Async-Stream

Django extension that allow using asynchronous generators in StreamingHttpResponse

Usage

django-async-stream provides AsyncStreamingHttpResponse class, that you can use instead of StreamingHttpResponse

But for this to work, you need to override one method in the ASGIHandler.

asgi.py, one of the possible options

# django default file content
import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'projectname.settings')

application = get_asgi_application()

#  PATCH BELOW
import django_async_stream
django_async_stream.patch_application(application)

views.py

import asyncio

from django_async_stream import AsyncStreamingHttpResponse


async def my_view(request):
    return AsyncStreamingHttpResponse(_my_async_generator())


async def _my_async_generator():
    for i in range(10):
        yield i
        await asyncio.sleep(2)

Installation

pip install django-async-stream

Metadata

Release files for django-async-stream 0.3

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

Source distribution (sdist)

Source distribution for django-async-stream 0.3
File Size Uploaded Provenance Actions
django-async-stream-0.3.tar.gz 2.6 kB Without provenance Details for django-async-stream-0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-async-stream 0.3
File Interpreter ABI Platform Actions
django_async_stream-0.3-py3-none-any.whl Python 3 none any Details for django_async_stream-0.3-py3-none-any.whl

Total release size: 5.8 kB

Release files / django-async-stream-0.3.tar.gz

Download URL django-async-stream-0.3.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
070e0dff90237e555abeae6c4ec6b1a83ac486f6ec35516cff398c7283d48cc3
BLAKE2b-256 checksum
How to use checksums
a6bdaffdb5667029f26c80001dcf6dd86ba237356f7c788ad32fa9925bc25349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release files / django_async_stream-0.3-py3-none-any.whl

Download URL django_async_stream-0.3-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77e98a656f18b4476ae8dc9afbb626383c86c3871ff39525c85c5124c89cc4ad
BLAKE2b-256 checksum
How to use checksums
e2a4178f94a99250e0882f5ddb906689a22a1e9221677360024712c85fdff812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Security for django-async-stream 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files No provenance

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