]> gitweb.pimeys.fr Git - scripts-20-100.git/blob - ftp/percent_decode.py
typo
[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 FOLLOW = False
20 if "-f" in sys.argv:
21 FOLLOW = True
22
23 run = True
24 try:
25 while run:
26 l = sys.stdin.readline()
27 if l != "":
28 l = urllib.unquote(l)
29 if "--color" in sys.argv:
30 l = l.replace('"PUT ', '"%sPUT%s ' % (red, nocolor))
31 sys.stdout.write(l)
32 elif not FOLLOW:
33 run = False
34 except KeyboardInterrupt:
35 pass