Skip to content

Instantly share code, notes, and snippets.

View Phuker's full-sized avatar
🌚
Writing nocode and deploying nowhere

Richard Phuker Phuker

🌚
Writing nocode and deploying nowhere
View GitHub Profile
@Phuker
Phuker / requests-limit-redirect-same-hostname.py
Last active December 6, 2022 15:56
Limit Python requests to only redirect to the same hostname (or same origin as well), and prevent redirecting to different hostnames (or cross origin)
#!/usr/bin/env python3
# encoding: utf-8
"""
https://gist.github.com/Phuker/62604216856936184029b7d24317cccf
"""
import logging
import urllib.parse

Keybase proof

I hereby claim:

  • I am Phuker on github.
  • I am phuker (https://keybase.io/phuker) on keybase.
  • I have a public key whose fingerprint is 7BC2 3915 9DD2 1BDC 4909 E089 63B7 4925 7482 8BAD

To claim this, I am signing this object: