Skip to content

Instantly share code, notes, and snippets.

Aapo Rista aapris

Block or report user

Report or block aapris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
aapris /
Last active Mar 5, 2019
Serialize Django>=2.2 HttpRequest
Sometimes you need to pass forward HttpRequest, which is not directly serializable.
serialize_django_request() takes Django HttpRequest as an argument, extracts
HttpRequest.headers (available since Django 2.2), HttpRequest.body and most interesting
values out from HttpRequest.META and returns them in a dict which is json, msgpack etc.
from django.http.request import HttpRequest
aapris /
Last active Sep 3, 2016
Pretty print your Foursquare history
# Pretty print your Foursquare history
# remember to "pip install requests ics" into you virtualenv
import sys
import requests
from ics import Calendar
ics_data = requests.get(sys.argv[1]).text
cal = Calendar(ics_data)
for e in
print("{} | {}".format(e.begin.format('YYYY-MM-DD HH:mm:ss ZZ'),'@ ')))

Keybase proof

I hereby claim:

  • I am aapris on github.
  • I am aapris ( on keybase.
  • I have a public key whose fingerprint is A35E 3622 48AD 67F6 6BEB FE71 7C58 6186 743C 17BF

To claim this, I am signing this object:

You can’t perform that action at this time.