title: Python Requests authentication with proxy for POST call
body: <p>I am using my company's internet, and I need to access a webpage to scrape data off it.  I am using the Python Requests module.  The page I need to access is done through a POST request.  My company has a proxy.  I can get through the proxy using the proxies flag in requests.post().  However, there is an authentication part which uses cookies, and I can't seem to get through it.  How should I do the authentication part when using a POST request?  </p>
  
  <p>I am trying to use the authentication process as described in this thread, but it's not working: 
  <a href="https://stackoverflow.com/questions/12397375/authentication-and-python-requests">Authentication and python Requests</a></p>
  
  <p>The code is set up this way: </p>
  
  <pre><code>import ssl
  from MyHtmlParser import MyHTMLParser
  from lxml import html 
  import requests 
  from bs4 import BeautifulSoup as bs
  
  def authenticate(s, url):
      headers = {'USER_NAME': 'me', 'PASSWORD': 'mypassword', '_Id': 'submit'}
      page=s.get(url)
      soup=bs(page.content)
      value=soup.form.find_all('input')[2]['value']
      headers.update({'value_name':value})
      auth = s.post(url, params=headers, cookies=page.cookies)
  
  post_url_finance = 'https://opsdata&lt;company&gt;com/scripts/finance/finance.exe'
  values_finance = {'EMPLOYEE_TOTAL': 'employeeId'}
  
  proxies = {'http': 'http://proxy-&lt;company&gt;.com'}
  
  page = requests.post(post_url_finance, data=values_finance, proxies=proxies) print page.content
  </code></pre>
  
  <p>However, I am getting this error back:</p>
  
  <pre><code>$ python postUsingRequests.py
  Traceback (most recent call last):
    File "postUsingRequests.py", line 53, in &lt;module&gt;
      page = requests.post(post_url_finance, data=values_finance, proxies=proxies) 
    File "C:\Python27\lib\site-packages\requests\api.py", line 109, in post
      return request('post', url, data=data, json=json, **kwargs)
    File "C:\Python27\lib\site-packages\requests\api.py", line 50, in request
      response = session.request(method=method, url=url, **kwargs)
    File "C:\Python27\lib\site-packages\requests\sessions.py", line 465, in request
      resp = self.send(prep, **send_kwargs)
    File "C:\Python27\lib\site-packages\requests\sessions.py", line 573, in send
      r = adapter.send(request, **kwargs)
    File "C:\Python27\lib\site-packages\requests\adapters.py", line 431, in send
      raise SSLError(e, request=request)
  requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
  </code></pre>