Python: how to dump cookies of a mechanize.Browser instance?

前端 未结 3 1990
执笔经年
执笔经年 2020-12-08 08:34

I am learning how to use mechanize, a Python module to automate interacting with websites.

One feature is the automated handling of cookies. I would to want to dump

3条回答
  •  时光说笑
    2020-12-08 09:24

    Just print the CookieJar Instance

    # Browser
    br = mechanize.Browser()
    
    # Cookie Jar
    cj = cookielib.LWPCookieJar()
    br.set_cookiejar(cj)
    
    # Dump
    print cj
    

提交回复
热议问题