The following code is my attempt at doing python requests through tor, this works fine, however I am interested in adding multithreading to this.
So I would like to simultaneously do about 10 different requests and process their outputs. What is the simplest and most efficient way to do this?
def onionrequest(url, onionid):
    onionid = onionid
    session = requests.session()
    session.proxies = {}
    session.proxies['http'] = 'socks5h://localhost:9050'
    session.proxies['https'] = 'socks5h://localhost:9050'
    #r = session.get('http://google.com')
    onionurlforrequest = "http://" + url
    try:
        r = session.get(onionurlforrequest, timeout=15)
    except:
        return None
    if r.status_code = 200:
        listofallonions.append(url)
 
    