Skip to content Skip to sidebar Skip to footer

How To Get Python Gspread To Use A SOCKS Proxy Server For Connections?

How could I get my script that's using gspread to have the gspread connections to google's servers use a SOCKS proxy?

Solution 1:

SocksiPy should work for this, as per the SO question: How can I use a SOCKS 4/5 proxy with urllib2?.

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

import gspread
# do whatever

If this is not the desired result, you may have to create a custom instance of the bundled HTTPSession object.


Post a Comment for "How To Get Python Gspread To Use A SOCKS Proxy Server For Connections?"