title: python requests lib is not working in amazon aws
body: <p>I am trying following code:</p>
  <pre><code>import requests
  
  headers = {
      'authority': 'www.nseindia.com',
      'upgrade-insecure-requests': '1',
      'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 OPR/72.0.3815.320',
      'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
      'sec-fetch-site': 'none',
      'sec-fetch-mode': 'navigate',
      'sec-fetch-user': '?1',
      'sec-fetch-dest': 'document',
      'accept-language': 'en-GB,en;q=0.9',
  }
  
  nse = requests.Session()
  x = nse.get(&quot;https://www.nseindia.com/&quot;, headers=headers)
  
  print(x.text)
  </code></pre>
  <p>Following code is working on my pc but when I put it in aws it is not responding.</p>
  <p>I have also checked ping <code>https://www.nseindia.com/</code> it is working.</p>
  <p>requests is working for other sites like google but not working for this specific site on aws.</p>
  <p>In EC2:</p>
  <pre><code>Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
  [GCC 9.3.0] on linux
  Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
  &gt;&gt;&gt; import requests
  &gt;&gt;&gt; headers = {
  ...     'authority': 'www.nseindia.com',
  ...     'upgrade-insecure-requests': '1',
  ...     'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 OPR/72.0.3815.320',
  ...     'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
  ...     'sec-fetch-site': 'none',
  ...     'sec-fetch-mode': 'navigate',
  ...     'sec-fetch-user': '?1',
  ...     'sec-fetch-dest': 'document',
  ...     'accept-language': 'en-GB,en;q=0.9',
  ... }
  &gt;&gt;&gt; nse = requests.Session()
  &gt;&gt;&gt; nse.get(&quot;https://www.nseindia.com/&quot;, headers=headers)
  </code></pre>
  <p>No output from last line.</p>
  <p>In my PC:</p>
  <pre><code>Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
  [GCC 9.3.0] on linux
  Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
  &gt;&gt;&gt; import requests
  &gt;&gt;&gt; headers = {
  ...     'authority': 'www.nseindia.com',
  ...     'upgrade-insecure-requests': '1',
  ...     'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 OPR/72.0.3815.320',
  ...     'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
  ...     'sec-fetch-site': 'none',
  ...     'sec-fetch-mode': 'navigate',
  ...     'sec-fetch-user': '?1',
  ...     'sec-fetch-dest': 'document',
  ...     'accept-language': 'en-GB,en;q=0.9',
  ... }
  &gt;&gt;&gt; nse = requests.Session()
  &gt;&gt;&gt; nse.get(&quot;https://www.nseindia.com/&quot;, headers=headers)
  &lt;Response [200]&gt;
  &gt;&gt;&gt; 
  </code></pre>
  <p>Problem detected:</p>
  <p>IN EC2</p>
  <pre><code>ping www.nseindia.com
  PING www.nseindia.com (23.9.215.115) 56(84) bytes of data.
  64 bytes from a23-9-215-115.deploy.static.akamaitechnologies.com (23.9.215.115): icmp_seq=1 ttl=51 time=1.07 ms
  64 bytes from a23-9-215-115.deploy.static.akamaitechnologies.com (23.9.215.115): icmp_seq=2 ttl=51 time=1.09 ms
  </code></pre>
  <p>IN PC</p>
  <pre><code>ping www.nseindia.com
  PING www.nseindia.com (23.35.32.140) 56(84) bytes of data.
  64 bytes from a23-35-32-140.deploy.static.akamaitechnologies.com (23.35.32.140): icmp_seq=1 ttl=57 time=65.8 ms
  64 bytes from a23-35-32-140.deploy.static.akamaitechnologies.com (23.35.32.140): icmp_seq=2 ttl=57 time=61.5 ms
  64 bytes from a23-35-32-140.deploy.static.akamaitechnologies.com (23.35.32.140): icmp_seq=3 ttl=57 time=73.1 ms
  </code></pre>
  <p>ping to different IP.</p>