Importing Cookies with Mechanize
<p>(Using Python 2.7, with Mechanize)</p>

<p>Let's say I have a cookie on Twitter, named <code>auth_token</code> and it's Value is: <code>ABC123</code>.</p>

<p><a href="http://i.stack.imgur.com/1GGXW.png" rel="nofollow"><img src="http://i.stack.imgur.com/1GGXW.png" alt="https://i.gyazo.com/de568907c939617c14a874696664aeeb.png"></a></p>

<p>How do tell <code>Mechanize</code> to import this Cookie? I've heard about <code>Cookielib</code> but I am not sure how to use it. I looked it up, but I've no clue how to set this up with <code>Mechanize</code>.</p>

<p>If someone could help me out, that would be awesome! :)</p>

<pre><code>import Cookie
import cookielib
cookiejar =cookielib.LWPCookieJar()

br = mechanize.Browser()
br.set_cookiejar(cookiejar)
cookie = cookielib.Cookie(auth_token='ABC123')
cookiejar.set_cookie(cookie)
</code></pre>

python cookies mechanize cookielib