title: How i can get new ip from tor every requests in threads?
body: <p>I try to use TOR proxy for scraping and everything works fine in one thread, but this is slow.
  I try to do something simple:</p>
  
  <pre class="lang-py prettyprint-override"><code>def get_new_ip():
      with Controller.from_port(port = 9051) as controller:
          controller.authenticate(password="password")
          controller.signal(Signal.NEWNYM)
          time.sleep(controller.get_newnym_wait())
  
  
  def check_ip():
      get_new_ip()
      session = requests.session()
      session.proxies = {'http': 'socks5h://localhost:9050', 'https': 'socks5h://localhost:9050'}
      r = session.get('http://httpbin.org/ip')
      r.text
  
  
  with Pool(processes=3) as pool:
      for _ in range(9):
          pool.apply_async(check_ip)
      pool.close()
      pool.join()
  </code></pre>
  
  <p>When I run it, I see the output:</p>
  
  <pre><code>{"origin": "95.179.181.1, 95.179.181.1"}
  {"origin": "95.179.181.1, 95.179.181.1"}
  {"origin": "95.179.181.1, 95.179.181.1"}
  {"origin": "151.80.53.232, 151.80.53.232"}
  {"origin": "151.80.53.232, 151.80.53.232"}
  {"origin": "151.80.53.232, 151.80.53.232"}
  {"origin": "145.239.169.47, 145.239.169.47"}
  {"origin": "145.239.169.47, 145.239.169.47"}
  {"origin": "145.239.169.47, 145.239.169.47"}
  </code></pre>
  
  <p>Why is this happening and how do I give each thread its own IP?
  By the way, I tried libraries like TorRequests, TorCtl the result is the same.</p>
  
  <p>I understand that it appears that TOR has a delay before issuing a new IP, but why do the same IP get into different processes?</p>