emptygif
భాష: తెలుగు

అన్ని భాషలు, ఫ్రేమ్‌వర్క్‌లు

Pyramid Python

/pixel.gif కు వచ్చే రిక్వెస్ట్‌లకు empty GIF తో జవాబిచ్చే, Pyramid కోసం Python స్నిపెట్. GIF స్టార్టప్‌లో ఒక్కసారే డీకోడ్ అవుతుంది.

Pyramid Python

ఇన్‌స్టాల్
pip install pyramid
ఫైల్
app.py
రన్
python app.py
import base64
from wsgiref.simple_server import make_server

from pyramid.config import Configurator
from pyramid.response import Response

GIF = base64.b64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")


def pixel(request):
    return Response(body=GIF, content_type="image/gif", cache_control="no-store")


if __name__ == "__main__":
    with Configurator() as config:
        config.add_route("pixel", "/pixel.gif")
        config.add_view(pixel, route_name="pixel", request_method="GET")
        app = config.make_wsgi_app()
    make_server("0.0.0.0", 8080, app).serve_forever()

మేము ఈ స్నిపెట్‌ను రన్ చేసి, అది తిరిగి ఇచ్చిన బైట్‌లను పోల్చి చూశాం.

చెక్ చేయండి

curl -sI http://localhost:8080/pixel.gif

అధికారిక సైట్: Pyramid

Python లో మరిన్ని