title: Receiving HTTP Error 403: Forbidden CSV download
body: <p>I am trying to access a csv programmatically at the following url: <a href="http://www.cmegroup.com/CmeWS/exp/voiProductDetailsViewExport.ctl?media=xls&amp;tradeDate=20180627&amp;reportType=F&amp;productId=425" rel="nofollow noreferrer">http://www.cmegroup.com/CmeWS/exp/voiProductDetailsViewExport.ctl?media=xls&amp;tradeDate=20180627&amp;reportType=F&amp;productId=425</a></p>
  
  <p>I have tried this in two ways, one by simply passing the URL to <code>data_sheet = pd.read_csv(sheet_url)</code>.  I receive an <code>HTTP Error 403: Forbidden</code> exception when trying with this method.</p>
  
  <pre><code>def get_sheet(self):
          # Accesses CME direct URL (at the moment...will add functionality for ICE later)
          # Gets sheet and puts it in dataframe
          #Returns dataframe sheet
  
          sheet_url = "http://www.cmegroup.com/CmeWS/exp/voiProductDetailsViewExport.ctl?media=xls&amp;tradeDate="+str(self.date_of_report)+"&amp;reportType="\
          + str(self.report_type)+"&amp;productId=" + str(self.product)
  
          header = {
              "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
              "X-Requested-With": "XMLHttpRequest"
          }
  
          data_sheet = pd.read_csv(sheet_url)
  
          return data_sheet
  </code></pre>
  
  <p>I have also tried pretending to be a browser thinking that perhaps the site was not allowing a direct call to the csv, but then I receive an <code>Invalid file path or buffer object type: &lt;class 'requests.models.Response'&gt;</code> exception</p>
  
  <pre><code>def get_sheet(self):
          # Accesses CME direct URL (at the moment...will add functionality for ICE later)
          # Gets sheet and puts it in dataframe
          #Returns dataframe sheet
  
          sheet_url = "http://www.cmegroup.com/CmeWS/exp/voiProductDetailsViewExport.ctl?media=xls&amp;tradeDate="+str(self.date_of_report)+"&amp;reportType="\
          + str(self.report_type)+"&amp;productId=" + str(self.product)
  
          header = {
              "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
              "X-Requested-With": "XMLHttpRequest"
          }
  
          req = requests.get(url = sheet_url, headers = header)
  
          data_sheet = pd.read_csv(req)
  
          return data_sheet
  </code></pre>
  
  <p>My end goal is to simply retrieve the CSV at that URL and and return a data frame.  What am I missing?</p>
  
  <p><strong>UPDATE:</strong> I have done some more fiddling and just printed <code>req</code> and i get an output of <code>Response [200]</code> which from what I can see in the HTTP docs means the server is receiving my information.  Does anyone know if the issue is that I am directly accessing a URL where a csv is stored that normally, if you click the button the url is associated with, it automatically downloads the file.  In checking my downloads folder I do not see any downloads for the file.  So while the server might be receiving a valid request I may not be handling the url behavior correctly.  Any ideas?</p>