import decimal, sys, re, math, urllib, subprocess, random, warnings
PIPE = subprocess.PIPE
warnings.filterwarnings("ignore")
check = subprocess.Popen("torify curl -s http://icanhazip.com/",stderr=None, stdout=PIPE, shell=PIPE)
check = str(check.stdout.read())
Что то такое не пойдет?