title: Download File using python script behind corporate proxy
body: <p>I am putting together a script that will download a file from the web .... However some ppl sit being a corporate firewall so this means that if you are @ home the below code works but if you are in the office it hangs unless you set proxy variable manually and then run ....</p>
  
  <p>What I am thinking is create an if statement ... The if statement will check the users IP address and if they user has an IP address in the 8.x or 9.x or 7.x then use this proxy ... Otherwise ignore and proceed with download</p>
  
  <p>The code I am using for this download is below ... I am pretty new to this so i am not sure how to do an if statement for the IP and then use proxy piece so any help would be great</p>
  
  <pre><code>import urllib.request
  import shutil
  import subprocess
  import os
  from os import system
  
  url = "https://downloads.com/App.exe"
  output_file = "C:\\User\\Downloads\\App.exe"
  with urllib.request.urlopen(url) as response, open(output_file, 'wb') as out_file:
      shutil.copyfileobj(response, out_file)
  
  </code></pre>