Tuesday, July 6, 2010

Making google app engine use socks proxy when fetching urls

Here's a simple recipe to do this:

1) Download and install socksipy
http://socksipy.sourceforge.net/

2) Add the following three lines after the import declarations to the file google/appengine/api/urlfetch_stub.py

import socks
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 1080)
socket.socket = socks.socksocket

3) restart app engine

Now the url fetch requests go thru your socks server running on port 1080

No comments:

Post a Comment