title: How to modify cookies in Requests
body: <p>I couldn't find any documentations regarding cookies modification in the official website, i.e. no api doc for <code>requests.cookies.RequestsCookieJar</code>.</p>
  
  <p>For example, </p>
  
  <pre><code>session = requests.Session()
  a = session.head('http://www.google.co.uk')
  
  session.cookies
  </code></pre>
  
  <blockquote>
    <p>&lt;[Cookie(version=0,
    name='NID',
    value='67=CXdvwjj9sjd-13Y0VyRQyUs8PxXaxyMhiGrrozXP7RWSjf-5alV4D17ORcfnZNYLAmlHXSVlHuS5LcuE4-v6vnzRQS-Gt72hgbGye0apoBoW5KJeVXA2o2E0gE-8jIeY',
    port=None, port_specified=False, domain='.google.co.uk',
    domain_specified=True, domain_initial_dot=True, path='/',
    path_specified=True, secure=False, expires=1424443599, discard=False,
    comment=None, comment_url=None, rest={'HttpOnly': None},
    rfc2109=False), Cookie(version=0, name='PREF',
    value='ID=41c5d5cac7d22262:FF=0:TM=1408632399:LM=1408632399:S=wTfY_LkkZnSsBxoL',
    port=None, port_specified=False, domain='.google.co.uk',
    domain_specified=True, domain_initial_dot=True, path='/',
    path_specified=True, secure=False, expires=1471704399, discard=False,
    comment=None, comment_url=None, rest={}, rfc2109=False)]></p>
  </blockquote>
  
  <p>Now I want to change value of 'NID'</p>
  
  <p>If I do <code>session.cookies['NID'] = 'abc'</code>, it would ended up with duplicated keys like the following:</p>
  
  <blockquote>
    <p>&lt;[Cookie(version=0,
    name='NID', value='abc', port=None, port_specified=False, domain='',
    domain_specified=False, domain_initial_dot=False, path='/',
    path_specified=True, secure=False, expires=None, discard=True,
    comment=None, comment_url=None, rest={'HttpOnly': None},
    rfc2109=False), Cookie(version=0, name='NID',
    value='67=CXdvwjj9sjd-13Y0VyRQyUs8PxXaxyMhiGrrozXP7RWSjf-5alV4D17ORcfnZNYLAmlHXSVlHuS5LcuE4-v6vnzRQS-Gt72hgbGye0apoBoW5KJeVXA2o2E0gE-8jIeY',
    port=None, port_specified=False, domain='.google.co.uk',
    domain_specified=True, domain_initial_dot=True, path='/',
    path_specified=True, secure=False, expires=1424443599, discard=False,
    comment=None, comment_url=None, rest={'HttpOnly': None},
    rfc2109=False), Cookie(version=0, name='PREF',
    value='ID=41c5d5cac7d22262:FF=0:TM=1408632399:LM=1408632399:S=wTfY_LkkZnSsBxoL',
    port=None, port_specified=False, domain='.google.co.uk',
    domain_specified=True, domain_initial_dot=True, path='/',
    path_specified=True, secure=False, expires=1471704399, discard=False,
    comment=None, comment_url=None, rest={}, rfc2109=False)]></p>
  </blockquote>
  
  <p>My current approach is to do <code>session.cookies['NID'] = None</code> first, this removes the key/value, and then <code>session.cookies['NID'] = 'abc'</code> This sometimes works, but it completely ignores the cookies attributes.</p>
  
  <p>What is a proper way of doing it?</p>