]> gitweb.pimeys.fr Git - scripts-20-100.git/blob - ftp/percent_decode.py
[bde/stats/depenses] Inversion gain/dépenses
[scripts-20-100.git] / ftp / percent_decode.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 """Piper dedans un flux avec des %20 et autres cochonneries,
5 il ressortira lisible."""
6
7 __author__ = "Vincent Le Gallic <legallic@crans.org>"
8
9 __license__ = "WTFPL"
10
11 import urllib
12 import sys
13 import time
14
15
16 red="\e[1;31m"
17 nocolor="\e[0m"
18
19 try:
20 while True:
21 l = sys.stdin.readline()
22 if l != "":
23 l = urllib.unquote(l)
24 if "--color" in sys.argv:
25 l = l.replace('"PUT ', '"%sPUT%s ' % (red, nocolor))
26 sys.stdout.write(l)
27 except KeyboardInterrupt:
28 pass