Created
April 9, 2014 07:27
-
-
Save simonw/10235798 to your computer and use it in GitHub Desktop.
Return a 1x1 pixel gif from Django (e.g. for a dynamic tracking pixel)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponse | |
PIXEL_GIF_DATA = """ | |
R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 | |
""".strip().decode('base64') | |
def pixel_gif(request): | |
return HttpResponse(PIXEL_GIF_DATA, content_type='image/gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Python 3
Thank you for this gist 👍