X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=ftp%2Fpercent_decode.py;fp=ftp%2Fpercent_decode.py;h=8fc51c9ef58e1f2c6ec9c64656522e9f74fab931;hb=8721c7c2bbdd6c692f168bdce241ccdc7dc4cb59;hp=0000000000000000000000000000000000000000;hpb=6fcc8a56ce98cb00472ab54c892aa712a5de1b54;p=scripts-20-100.git diff --git a/ftp/percent_decode.py b/ftp/percent_decode.py new file mode 100755 index 0000000..8fc51c9 --- /dev/null +++ b/ftp/percent_decode.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""Piper dedans un flux avec des %20 et autres cochonneries, + il ressortira lisible.""" + +__author__ = "Vincent Le Gallic " + +__license__ = "WTFPL" + +import urllib +import sys +import time + + +red="" +nocolor="" + +try: + while True: + l = sys.stdin.readline() + if l != "": + l = urllib.unquote(l) + if "--color" in sys.argv: + l = l.replace('"PUT ', '"%sPUT%s ' % (red, nocolor)) + sys.stdout.write(l) +except KeyboardInterrupt: + pass