title: Unable to connect to Tor using requests whereas I did the same using selenium
body: <p>I've written two scripts in python: one using <code>selenium</code> and the other using <code>requests</code> to connect to <strong><em><a href="http://check.torproject.org" rel="nofollow noreferrer">http://check.torproject.org</a></em></strong> using <strong><em>Tor</em></strong> and get this piece of text <strong><em>Congratulations. This browser is configured to use Tor</em></strong> from there in order to be sure I'm doing things in the right way.</p>
  
  <p>When I use the below script I cen get the text smoothly:</p>
  
  <pre><code>from selenium import webdriver
  import os
  
  torexe = os.popen(r"C:\Users\WCS\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe")
  
  options = webdriver.ChromeOptions()
  options.add_argument('--proxy-server=socks5://localhost:9050')
  driver = webdriver.Chrome(chrome_options=options)
  
  driver.get("http://check.torproject.org")
  item = driver.find_element_by_css_selector("h1.not").text
  print(item)
  
  driver.quit()
  </code></pre>
  
  <p>However, when I try to do the same using <code>requests</code>, I get an error <code>AttributeError: 'NoneType' object has no attribute 'text'</code>:</p>
  
  <pre><code>import requests
  from bs4 import BeautifulSoup
  import os
  
  torexe = os.popen(r"C:\Users\WCS\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe")
  
  with requests.Session() as s:
      s.proxies['http'] = 'socks5://localhost:9050'
      res = s.get("http://check.torproject.org")
      soup = BeautifulSoup(res.text,"lxml")
      item = soup.select_one("h1.not").text
      print(item)
  </code></pre>
  
  <p><strong><em>How can I get the same text using <code>requests</code> from that site?</em></strong></p>
  
  <p>When I use this <code>print(soup.title.text)</code>, I can get this text <code>Sorry. You are not using Tor.</code> which clearly indicates that the <code>requests</code> is not made via <code>Tor</code>.</p>