title: How to make a POST with previous cookies with Python Requests library or PyCurl?
body: <p>I am trying to make a POST with some data and the cookies received before with a GET.
  I had a code with <a href="http://pycurl.io/docs/latest/index.html" rel="nofollow noreferrer">PyCurl</a> that works correctly but I need to use <a href="http://docs.python-requests.org/en/master/" rel="nofollow noreferrer">Requests</a>. However, the using Request does not work although I am doing the same steps.
  The working code on PyCurl is:</p>
  
  <pre><code>import time
  import urllib
  import pycurl
  
  curl = pycurl.Curl()
  curl.setopt(pycurl.URL, 'https://www.myURL.com/header?time='+str(int(time.time())))
  curl.setopt(pycurl.COOKIEJAR, 'cookie_1.txt')
  curl.perform()
  curl.close()
  
  curl = pycurl.Curl()
  curl.setopt(pycurl.URL, 'https://www.myURL.com/login')
  post_data = {'actualURL': 'http://www.myURL.com', 'user': 'myemail@gmail.com', 'pass': 'asdfqwerty'}
  curl.setopt(pycurl.COOKIEFILE, 'cookie_1.txt')
  curl.setopt(pycurl.POSTFIELDS, urllib.urlencode(post_data))
  curl.setopt(pycurl.COOKIEJAR, 'cookie_2.txt')
  curl.perform()
  curl.close()
  </code></pre>
  
  <p>I receive in 'cookie_2.txt' file the correct answer with new data on cookies.
  However, as said before, the following code give me a response of Error 403</p>
  
  <pre><code>import time
  import urllib
  import requests
  
  r1 = requests.get('https://www.myURL.com/header?time='+str(int(time.time())))
  payload = {'actualURL': 'http://www.myURL.com', 'user': 'myemail@gmail.com', 'pass': 'asdfqwerty'}
  r2 = requests.post('https://www.myURL.com/login', data=urllib.urlencode(payload), cookies=r1.cookies)
  </code></pre>
  
  <p>As you can see, I use the same cookies received from previous request as mentioned <a href="https://stackoverflow.com/questions/7164679/how-to-send-cookies-in-a-post-request-with-the-python-requests-library">here</a>. I checked 'r1.cookies' and are set correct.
  Also, as POST data has special characters I used an encoding from urllib (PyCurl does not work without this).</p>
  
  <p>I firstly thought that the problem on '<strong>Requests</strong>' comes from special characters on POST data, but I have tried with encoding, without encoding, as a json string,... but nothing works. 'r2.cookies' is empty</p>