Created
April 19, 2011 11:18
-
-
Save karteek/927153 to your computer and use it in GitHub Desktop.
Gist for replacing an image using Squid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
def is_logo(url): | |
# This logo1w.png can change each day | |
if url.endswith('logo1w.png'): | |
return True | |
else: | |
return False | |
while True: | |
input_line = sys.stdin.readline().strip() | |
url = input_line.split(' ')[0] | |
if is_logo(url): | |
new_url = 'http://path.to.localserver/images/ashok.png\n' | |
else: | |
new_url = url + '\n' | |
# Do note that new_url should end with a \n | |
sys.stdout.write(new_url) | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment