Skip to content

Instantly share code, notes, and snippets.

@h4sh5
Created February 27, 2020 23:16
Show Gist options
  • Save h4sh5/476fde0f8c95c8c2e1755d8dfbd01066 to your computer and use it in GitHub Desktop.
Save h4sh5/476fde0f8c95c8c2e1755d8dfbd01066 to your computer and use it in GitHub Desktop.
encode XML to SAML
#!/usr/bin/env python
import zlib, base64
import sys
import urllib
d = sys.stdin.read()
b = base64.b64encode(zlib.compress(d.encode('utf-8'))[2:-4])
print urllib.quote_plus(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment