title: Python Requests : How to get response cookie from 302 redirect
body: <p>I'm trying to make an automation that will send the http requests to follow or unfollow a user through an instagram api, right now I'm using the Python Requests module and Im trying to do it through the site '<a href="http://pikore.com" rel="noreferrer">http://pikore.com</a>'. My current code is is : </p>
  
  <pre><code>import requests
  from requests.auth import HTTPBasicAuth
  
  s = requests.Session()
  s.get('http://pikore.com')
  
  print(s.cookies)
  s.get('http://www.pikore.com/session/new?from=%2F', auth=HTTPBasicAuth('USERNAME', 'USERSECRET'))
  pikore_session = s.cookies['_pikore_session']
  print(s.cookies)
  s.get('http://pikore.com')
  print(s.cookies)
  
  cookies = {
  '_pikore_session': pikore_session,
  'token': 'BAhJIjcyNTY5NDczOTIuZWIxM2FlYi41Mjc3ZTI4NjI4ZDM0NDRlOGRjNWNjZmFjNWU3YmJmYgY6BkVU--9b52c6305368f28c83ffc288e9d55e94b3e864db',
  }
  
  headers = {
      'Host': 'www.pikore.com',
      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
      'Referer': 'http://www.pikore.com/nike',
  }
  
  print(s.get('http://www.pikore.com/follow/13460080', headers=headers, cookies=cookies))
  s.get('http://www.pikore.com/')
  print(s.cookies)
  </code></pre>
  
  <p>So this works and will carry out the given request, the only thing is, the authorization line will only get the '_pikore_session' cookie, but not the token cookie, which I want to get. 
  After you log in through the instagram authorization redirect, it will redirect you three times and then finally you'll land on the website, logged in, but on the third redirect, I can see that it outputs the 'token' response cookie, I want to someone get that so that I dont have to go and get it each time manually. </p>